MDL-53700 competency: Migrate main classes to core
authorFrederic Massart <fred@moodle.com>
Mon, 4 Apr 2016 10:36:07 +0000 (18:36 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 18 Apr 2016 03:05:59 +0000 (11:05 +0800)
152 files changed:
admin/tool/lp/amd/build/competency_rule_all.min.js
admin/tool/lp/amd/build/competency_rule_points.min.js
admin/tool/lp/amd/src/competency_rule_all.js
admin/tool/lp/amd/src/competency_rule_points.js
admin/tool/lp/backup/moodle2/backup_tool_lp_plugin.class.php
admin/tool/lp/backup/moodle2/restore_tool_lp_plugin.class.php
admin/tool/lp/classes/api.php
admin/tool/lp/classes/course_competency_rule_form_element.php
admin/tool/lp/classes/event/competency_created.php
admin/tool/lp/classes/event/competency_deleted.php
admin/tool/lp/classes/event/competency_framework_created.php
admin/tool/lp/classes/event/competency_framework_deleted.php
admin/tool/lp/classes/event/competency_framework_updated.php
admin/tool/lp/classes/event/competency_framework_viewed.php
admin/tool/lp/classes/event/competency_updated.php
admin/tool/lp/classes/event/competency_viewed.php
admin/tool/lp/classes/event/evidence_created.php
admin/tool/lp/classes/event/plan_approved.php
admin/tool/lp/classes/event/plan_completed.php
admin/tool/lp/classes/event/plan_created.php
admin/tool/lp/classes/event/plan_deleted.php
admin/tool/lp/classes/event/plan_reopened.php
admin/tool/lp/classes/event/plan_review_request_cancelled.php
admin/tool/lp/classes/event/plan_review_requested.php
admin/tool/lp/classes/event/plan_review_started.php
admin/tool/lp/classes/event/plan_review_stopped.php
admin/tool/lp/classes/event/plan_unapproved.php
admin/tool/lp/classes/event/plan_unlinked.php
admin/tool/lp/classes/event/plan_updated.php
admin/tool/lp/classes/event/plan_viewed.php
admin/tool/lp/classes/event/template_created.php
admin/tool/lp/classes/event/template_deleted.php
admin/tool/lp/classes/event/template_updated.php
admin/tool/lp/classes/event/template_viewed.php
admin/tool/lp/classes/event/user_competency_grade_rated.php
admin/tool/lp/classes/event/user_competency_grade_rated_in_course.php
admin/tool/lp/classes/event/user_competency_grade_rated_in_plan.php
admin/tool/lp/classes/event/user_competency_plan_viewed.php
admin/tool/lp/classes/event/user_competency_review_request_cancelled.php
admin/tool/lp/classes/event/user_competency_review_requested.php
admin/tool/lp/classes/event/user_competency_review_started.php
admin/tool/lp/classes/event/user_competency_review_stopped.php
admin/tool/lp/classes/event/user_competency_viewed.php
admin/tool/lp/classes/event/user_competency_viewed_in_course.php
admin/tool/lp/classes/event/user_competency_viewed_in_plan.php
admin/tool/lp/classes/event/user_evidence_created.php
admin/tool/lp/classes/event/user_evidence_deleted.php
admin/tool/lp/classes/event/user_evidence_updated.php
admin/tool/lp/classes/external.php
admin/tool/lp/classes/external/competency_exporter.php
admin/tool/lp/classes/external/competency_framework_exporter.php
admin/tool/lp/classes/external/competency_path_exporter.php
admin/tool/lp/classes/external/competency_summary_exporter.php
admin/tool/lp/classes/external/course_competency_exporter.php
admin/tool/lp/classes/external/course_competency_settings_exporter.php
admin/tool/lp/classes/external/course_module_competency_exporter.php
admin/tool/lp/classes/external/evidence_exporter.php
admin/tool/lp/classes/external/exporter.php
admin/tool/lp/classes/external/persistent_exporter.php
admin/tool/lp/classes/external/plan_competency_exporter.php
admin/tool/lp/classes/external/plan_exporter.php
admin/tool/lp/classes/external/related_competency_exporter.php
admin/tool/lp/classes/external/template_competency_exporter.php
admin/tool/lp/classes/external/template_exporter.php
admin/tool/lp/classes/external/user_competency_course_exporter.php
admin/tool/lp/classes/external/user_competency_exporter.php
admin/tool/lp/classes/external/user_competency_plan_exporter.php
admin/tool/lp/classes/external/user_competency_summary_exporter.php
admin/tool/lp/classes/external/user_competency_summary_in_course_exporter.php
admin/tool/lp/classes/external/user_competency_summary_in_plan_exporter.php
admin/tool/lp/classes/external/user_evidence_competency_exporter.php
admin/tool/lp/classes/external/user_evidence_competency_summary_exporter.php
admin/tool/lp/classes/external/user_evidence_exporter.php
admin/tool/lp/classes/external/user_evidence_summary_exporter.php
admin/tool/lp/classes/form/competency.php
admin/tool/lp/classes/form/competency_framework.php
admin/tool/lp/classes/form/framework_autocomplete.php
admin/tool/lp/classes/form/persistent.php
admin/tool/lp/classes/form/plan.php
admin/tool/lp/classes/form/template.php
admin/tool/lp/classes/form/user_evidence.php
admin/tool/lp/classes/output/competency_summary.php
admin/tool/lp/classes/output/course_competencies_page.php
admin/tool/lp/classes/output/manage_competencies_page.php
admin/tool/lp/classes/output/manage_competency_frameworks_page.php
admin/tool/lp/classes/output/manage_templates_page.php
admin/tool/lp/classes/output/plan_page.php
admin/tool/lp/classes/output/plans_page.php
admin/tool/lp/classes/output/template_cohorts_page.php
admin/tool/lp/classes/output/template_cohorts_table.php
admin/tool/lp/classes/output/template_competencies_page.php
admin/tool/lp/classes/output/template_plans_page.php
admin/tool/lp/classes/output/template_plans_table.php
admin/tool/lp/classes/output/user_competency_summary.php
admin/tool/lp/classes/output/user_competency_summary_in_course.php
admin/tool/lp/classes/output/user_evidence_list_page.php
admin/tool/lp/classes/page_helper.php
admin/tool/lp/classes/template_statistics.php
admin/tool/lp/competencies.php
admin/tool/lp/competencyframeworks.php
admin/tool/lp/db/events.php
admin/tool/lp/editcompetencyframework.php
admin/tool/lp/editplan.php
admin/tool/lp/edittemplate.php
admin/tool/lp/learningplans.php
admin/tool/lp/lib.php
admin/tool/lp/template_cohorts.php
admin/tool/lp/tests/api_test.php
admin/tool/lp/tests/behat/behat_tool_lp_data_generators.php
admin/tool/lp/tests/competency_rule_test.php
admin/tool/lp/tests/course_competency_settings_test.php
admin/tool/lp/tests/course_competency_test.php
admin/tool/lp/tests/event_test.php
admin/tool/lp/tests/externallib_test.php
admin/tool/lp/tests/generator/lib.php
admin/tool/lp/tests/generator_test.php
admin/tool/lp/tests/lib_test.php
admin/tool/lp/tests/persistent_test.php
admin/tool/lp/tests/plan_persistent_test.php
admin/tool/lp/tests/plan_test.php
admin/tool/lp/tests/task_test.php
admin/tool/lp/tests/template_test.php
admin/tool/lp/tests/user_evidence_competency_test.php
admin/tool/lp/user_competency_in_course.php
admin/tool/lp/user_competency_in_plan.php
admin/tool/lp/user_evidence_edit.php
competency/classes/competency.php [moved from admin/tool/lp/classes/competency.php with 98% similarity]
competency/classes/competency_framework.php [moved from admin/tool/lp/classes/competency_framework.php with 99% similarity]
competency/classes/competency_rule.php [moved from admin/tool/lp/classes/competency_rule.php with 97% similarity]
competency/classes/competency_rule_all.php [moved from admin/tool/lp/classes/competency_rule_all.php with 97% similarity]
competency/classes/competency_rule_points.php [moved from admin/tool/lp/classes/competency_rule_points.php with 98% similarity]
competency/classes/course_competency.php [moved from admin/tool/lp/classes/course_competency.php with 99% similarity]
competency/classes/course_competency_settings.php [moved from admin/tool/lp/classes/course_competency_settings.php with 98% similarity]
competency/classes/course_module_competency.php [moved from admin/tool/lp/classes/course_module_competency.php with 99% similarity]
competency/classes/evidence.php [moved from admin/tool/lp/classes/evidence.php with 98% similarity]
competency/classes/invalid_persistent_exception.php [moved from admin/tool/lp/classes/invalid_persistent_exception.php with 87% similarity]
competency/classes/persistent.php [moved from admin/tool/lp/classes/persistent.php with 98% similarity]
competency/classes/plan.php [moved from admin/tool/lp/classes/plan.php with 99% similarity]
competency/classes/plan_competency.php [moved from admin/tool/lp/classes/plan_competency.php with 98% similarity]
competency/classes/related_competency.php [moved from admin/tool/lp/classes/related_competency.php with 98% similarity]
competency/classes/template.php [moved from admin/tool/lp/classes/template.php with 99% similarity]
competency/classes/template_cohort.php [moved from admin/tool/lp/classes/template_cohort.php with 97% similarity]
competency/classes/template_competency.php [moved from admin/tool/lp/classes/template_competency.php with 99% similarity]
competency/classes/user_competency.php [moved from admin/tool/lp/classes/user_competency.php with 99% similarity]
competency/classes/user_competency_course.php [moved from admin/tool/lp/classes/user_competency_course.php with 94% similarity]
competency/classes/user_competency_plan.php [moved from admin/tool/lp/classes/user_competency_plan.php with 98% similarity]
competency/classes/user_evidence.php [moved from admin/tool/lp/classes/user_evidence.php with 95% similarity]
competency/classes/user_evidence_competency.php [moved from admin/tool/lp/classes/user_evidence_competency.php with 98% similarity]
lib/classes/component.php
lib/classes/task/complete_plans_task.php
lib/classes/task/sync_plans_from_template_cohorts_task.php
lib/tests/component_test.php

index 664f904..d95f6a0 100644 (file)
Binary files a/admin/tool/lp/amd/build/competency_rule_all.min.js and b/admin/tool/lp/amd/build/competency_rule_all.min.js differ
index 7a2d9aa..39eaef7 100644 (file)
Binary files a/admin/tool/lp/amd/build/competency_rule_points.min.js and b/admin/tool/lp/amd/build/competency_rule_points.min.js differ
index dad5a56..db46330 100644 (file)
@@ -42,7 +42,7 @@ define(['jquery',
      * @method getType
      */
     Rule.prototype.getType = function() {
-        return 'tool_lp\\competency_rule_all';
+        return 'core_competency\\competency_rule_all';
     };
 
     /**
index 700d70e..470bb5d 100644 (file)
@@ -100,7 +100,7 @@ define(['jquery',
      * @method getType
      */
     Rule.prototype.getType = function() {
-        return 'tool_lp\\competency_rule_points';
+        return 'core_competency\\competency_rule_points';
     };
 
     /**
index e4f6f90..608cf10 100644 (file)
@@ -55,7 +55,7 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
         $pluginwrapper->add_child($coursecompetencysettings);
 
         $sql = 'SELECT s.pushratingstouserplans
-                  FROM {' . \tool_lp\course_competency_settings::TABLE . '} s
+                  FROM {' . \core_competency\course_competency_settings::TABLE . '} s
                  WHERE s.courseid = :courseid';
         $coursecompetencysettings->set_source_sql($sql, array('courseid' => backup::VAR_COURSEID));
 
@@ -65,9 +65,9 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
         $coursecompetencies->add_child($competency);
 
         $sql = 'SELECT c.idnumber, cc.ruleoutcome, cc.sortorder, f.idnumber AS frameworkidnumber
-                  FROM {' . \tool_lp\course_competency::TABLE . '} cc
-                  JOIN {' . \tool_lp\competency::TABLE . '} c ON c.id = cc.competencyid
-                  JOIN {' . \tool_lp\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
+                  FROM {' . \core_competency\course_competency::TABLE . '} cc
+                  JOIN {' . \core_competency\competency::TABLE . '} c ON c.id = cc.competencyid
+                  JOIN {' . \core_competency\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
                  WHERE cc.courseid = :courseid
               ORDER BY cc.sortorder';
         $competency->set_source_sql($sql, array('courseid' => backup::VAR_COURSEID));
@@ -94,9 +94,9 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
         $coursecompetencies->add_child($competency);
 
         $sql = 'SELECT c.idnumber, cmc.ruleoutcome, cmc.sortorder, f.idnumber AS frameworkidnumber
-                  FROM {' . \tool_lp\course_module_competency::TABLE . '} cmc
-                  JOIN {' . \tool_lp\competency::TABLE . '} c ON c.id = cmc.competencyid
-                  JOIN {' . \tool_lp\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
+                  FROM {' . \core_competency\course_module_competency::TABLE . '} cmc
+                  JOIN {' . \core_competency\competency::TABLE . '} c ON c.id = cmc.competencyid
+                  JOIN {' . \core_competency\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
                  WHERE cmc.cmid = :coursemoduleid
               ORDER BY cmc.sortorder';
         $competency->set_source_sql($sql, array('coursemoduleid' => backup::VAR_MODID));
@@ -111,7 +111,7 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
      */
     protected function get_include_condition() {
         $result = '';
-        if (\tool_lp\course_competency::record_exists_select('courseid = ?', array($this->task->get_courseid()))) {
+        if (\core_competency\course_competency::record_exists_select('courseid = ?', array($this->task->get_courseid()))) {
             $result = 'include';
         };
         return array('sqlparam' => $result);
index bd6c959..149ebf2 100644 (file)
@@ -70,7 +70,7 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
 
         $data = (object) $data;
         $courseid = $this->task->get_courseid();
-        $exists = \tool_lp\course_competency_settings::get_record(array('courseid' => $courseid));
+        $exists = \core_competency\course_competency_settings::get_record(array('courseid' => $courseid));
 
         // Now update or insert.
         if ($exists) {
@@ -79,7 +79,7 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
             return $settings->update();
         } else {
             $data = (object) array('courseid' => $courseid, 'pushratingstouserplans' => $data->pushratingstouserplans);
-            $settings = new \tool_lp\course_competency_settings(0, $data);
+            $settings = new \core_competency\course_competency_settings(0, $data);
             return !empty($settings->create());
         }
     }
@@ -93,11 +93,11 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
         $data = (object) $data;
 
         // Mapping the competency by ID numbers.
-        $framework = \tool_lp\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
+        $framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
         if (!$framework) {
             return;
         }
-        $competency = \tool_lp\competency::get_record(array('idnumber' => $data->idnumber,
+        $competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
             'competencyframeworkid' => $framework->get_id()));
         if (!$competency) {
             return;
@@ -108,13 +108,13 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
             'courseid' => $this->task->get_courseid()
         );
         $query = 'competencyid = :competencyid AND courseid = :courseid';
-        $existing = \tool_lp\course_competency::record_exists_select($query, $params);
+        $existing = \core_competency\course_competency::record_exists_select($query, $params);
 
         if (!$existing) {
             // Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
             $record = (object) $params;
             $record->ruleoutcome = $data->ruleoutcome;
-            $coursecompetency = new \tool_lp\course_competency(0, $record);
+            $coursecompetency = new \core_competency\course_competency(0, $record);
             $coursecompetency->create();
         }
 
@@ -129,11 +129,11 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
         $data = (object) $data;
 
         // Mapping the competency by ID numbers.
-        $framework = \tool_lp\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
+        $framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
         if (!$framework) {
             return;
         }
-        $competency = \tool_lp\competency::get_record(array('idnumber' => $data->idnumber,
+        $competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
             'competencyframeworkid' => $framework->get_id()));
         if (!$competency) {
             return;
@@ -144,13 +144,13 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
             'cmid' => $this->task->get_moduleid()
         );
         $query = 'competencyid = :competencyid AND cmid = :cmid';
-        $existing = \tool_lp\course_module_competency::record_exists_select($query, $params);
+        $existing = \core_competency\course_module_competency::record_exists_select($query, $params);
 
         if (!$existing) {
             // Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
             $record = (object) $params;
             $record->ruleoutcome = $data->ruleoutcome;
-            $coursemodulecompetency = new \tool_lp\course_module_competency(0, $record);
+            $coursemodulecompetency = new \core_competency\course_module_competency(0, $record);
             $coursemodulecompetency->create();
         }
 
index a7e6335..330b070 100644 (file)
@@ -36,6 +36,23 @@ use require_login_exception;
 use moodle_exception;
 use moodle_url;
 use required_capability_exception;
+use \core_competency\competency;
+use \core_competency\competency_framework;
+use \core_competency\course_competency;
+use \core_competency\course_competency_settings;
+use \core_competency\course_module_competency;
+use \core_competency\evidence;
+use \core_competency\plan;
+use \core_competency\plan_competency;
+use \core_competency\related_competency;
+use \core_competency\template;
+use \core_competency\template_cohort;
+use \core_competency\template_competency;
+use \core_competency\user_competency;
+use \core_competency\user_competency_course;
+use \core_competency\user_competency_plan;
+use \core_competency\user_evidence;
+use \core_competency\user_evidence_competency;
 
 /**
  * Class for doing things with competency frameworks.
@@ -1089,8 +1106,8 @@ class api {
      *
      * @param mixed $courseorid The course, or its ID.
      * @return array( array(
-     *                   'competency' => \tool_lp\competency,
-     *                   'coursecompetency' => \tool_lp\course_competency
+     *                   'competency' => \core_competency\competency,
+     *                   'coursecompetency' => \core_competency\course_competency
      *              ))
      */
     public static function list_course_competencies($courseorid) {
@@ -1169,8 +1186,8 @@ class api {
      *
      * @param mixed $cmorid The course module, or its ID.
      * @return array( array(
-     *                   'competency' => \tool_lp\competency,
-     *                   'coursemodulecompetency' => \tool_lp\course_module_competency
+     *                   'competency' => \core_competency\competency,
+     *                   'coursemodulecompetency' => \core_competency\course_module_competency
      *              ))
      */
     public static function list_course_module_competencies($cmorid) {
@@ -2286,7 +2303,7 @@ class api {
      * Lists user plans.
      *
      * @param int $userid
-     * @return \tool_lp\plan[]
+     * @return \core_competency\plan[]
      */
     public static function list_user_plans($userid) {
         global $DB, $USER;
@@ -2415,7 +2432,7 @@ class api {
      * Creates a learning plan based on the provided data.
      *
      * @param stdClass $record
-     * @return \tool_lp\plan
+     * @return \core_competency\plan
      */
     public static function create_plan(stdClass $record) {
         global $USER;
@@ -2445,7 +2462,7 @@ class api {
      *
      * @param  mixed $templateorid The template object or ID.
      * @param  int $userid
-     * @return false|\tool_lp\plan Returns false when the plan already exists.
+     * @return false|\core_competency\plan Returns false when the plan already exists.
      */
     public static function create_plan_from_template($templateorid, $userid) {
         static::require_enabled();
@@ -2581,7 +2598,7 @@ class api {
     /**
      * Unlink a plan from its template.
      *
-     * @param  \tool_lp\plan|int $planorid The plan or its ID.
+     * @param  \core_competency\plan|int $planorid The plan or its ID.
      * @return bool
      */
     public static function unlink_plan_from_template($planorid) {
@@ -2639,7 +2656,7 @@ class api {
      * Updates a plan.
      *
      * @param stdClass $record
-     * @return \tool_lp\plan
+     * @return \core_competency\plan
      */
     public static function update_plan(stdClass $record) {
         static::require_enabled();
@@ -2685,7 +2702,7 @@ class api {
      * Returns a plan data.
      *
      * @param int $id
-     * @return \tool_lp\plan
+     * @return \core_competency\plan
      */
     public static function read_plan($id) {
         static::require_enabled();
@@ -3106,9 +3123,9 @@ class api {
      * @param  int $planorid The plan, or its ID.
      * @param  int $competencyid The competency id.
      * @return (object) array(
-     *                      'competency' => \tool_lp\competency,
-     *                      'usercompetency' => \tool_lp\user_competency
-     *                      'usercompetencyplan' => \tool_lp\user_competency_plan
+     *                      'competency' => \core_competency\competency,
+     *                      'usercompetency' => \core_competency\user_competency
+     *                      'usercompetencyplan' => \core_competency\user_competency_plan
      *                  )
      *         The values of of keys usercompetency and usercompetencyplan cannot be defined at the same time.
      */
@@ -3163,9 +3180,9 @@ class api {
      *
      * @param  int $planorid The plan, or its ID.
      * @return array((object) array(
-     *                            'competency' => \tool_lp\competency,
-     *                            'usercompetency' => \tool_lp\user_competency
-     *                            'usercompetencyplan' => \tool_lp\user_competency_plan
+     *                            'competency' => \core_competency\competency,
+     *                            'usercompetency' => \core_competency\user_competency
+     *                            'usercompetencyplan' => \core_competency\user_competency_plan
      *                        ))
      *         The values of of keys usercompetency and usercompetencyplan cannot be defined at the same time.
      */
@@ -4063,8 +4080,8 @@ class api {
      * @param string $order The ordering of the sorting.
      * @param int $skip Number of records to skip.
      * @param int $limit Number of records to return.
-     * @return \tool_lp\evidence[]
-     * @return array of \tool_lp\evidence
+     * @return \core_competency\evidence[]
+     * @return array of \core_competency\evidence
      */
     public static function list_evidence($userid = 0,
                                          $competencyid = 0,
@@ -4117,7 +4134,7 @@ class api {
      * @param string $order The ordering of the sorting.
      * @param int $skip Number of records to skip.
      * @param int $limit Number of records to return.
-     * @return \tool_lp\evidence[]
+     * @return \core_competency\evidence[]
      */
     public static function list_evidence_in_course($userid = 0,
                                                    $courseid = 0,
@@ -4153,7 +4170,7 @@ class api {
      * @param int $userid The user id for which evidence is added.
      * @param competency|int $competencyorid The competency, or its id for which evidence is added.
      * @param context|int $contextorid The context in which the evidence took place.
-     * @param int $action The type of action to take on the competency. \tool_lp\evidence::ACTION_*.
+     * @param int $action The type of action to take on the competency. \core_competency\evidence::ACTION_*.
      * @param string $descidentifier The strings identifier.
      * @param string $desccomponent The strings component.
      * @param mixed $desca Any arguments the string requires.
@@ -4448,6 +4465,7 @@ class api {
             return;
         }
 
+
         // Fetch or create the user competency for the parent.
         $userid = $usercompetency->get_userid();
         $parentuc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $parent->get_id()));
@@ -4456,6 +4474,7 @@ class api {
             $parentuc->create();
         }
 
+
         // Does the rule match?
         if (!$rule->matches($parentuc)) {
             return;
@@ -4617,7 +4636,7 @@ class api {
      * @param int $competencyid
      * @param int $grade
      * @param string $note A note to attach to the evidence
-     * @return array of \tool_lp\user_competency
+     * @return array of \core_competency\user_competency
      */
     public static function grade_competency($userid, $competencyid, $grade, $note = null) {
         global $USER;
@@ -4666,7 +4685,7 @@ class api {
      * @param int $competencyid
      * @param int $grade
      * @param string $note A note to attach to the evidence
-     * @return array of \tool_lp\user_competency
+     * @return array of \core_competency\user_competency
      */
     public static function grade_competency_in_plan($planorid, $competencyid, $grade, $note = null) {
         global $USER;
@@ -4723,7 +4742,7 @@ class api {
      * @param int $competencyid
      * @param int $grade
      * @param string $note A note to attach to the evidence
-     * @return array of \tool_lp\user_competency
+     * @return array of \core_competency\user_competency
      */
     public static function grade_competency_in_course($courseorid, $userid, $competencyid, $grade, $note = null) {
         global $USER, $DB;
index 675a78d..001fe7c 100644 (file)
@@ -29,7 +29,7 @@ global $CFG;
 
 use tool_lp\api;
 use tool_lp\external\competency_exporter;
-use tool_lp\course_module_competency;
+use core_competency\course_module_competency;
 
 require_once($CFG->libdir . '/form/select.php');
 
index 3c929f4..ed7886e 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency;
+use core_competency\competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index eb316a6..de2329e 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency;
+use core_competency\competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index b8f6855..e57dd9e 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency_framework;
+use core_competency\competency_framework;
 
 defined('MOODLE_INTERNAL') || die();
 
index 9c6abc0..8f86d6a 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency_framework;
+use core_competency\competency_framework;
 
 defined('MOODLE_INTERNAL') || die();
 
index b592d9a..d2c7230 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency_framework;
+use core_competency\competency_framework;
 
 defined('MOODLE_INTERNAL') || die();
 
index 68bd486..1784c50 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency_framework;
+use core_competency\competency_framework;
 
 defined('MOODLE_INTERNAL') || die();
 
index 6a4fbb8..d8f1b71 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency;
+use core_competency\competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index e10b3c5..a9def68 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\competency;
+use core_competency\competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index 70e103e..46004af 100644 (file)
@@ -24,8 +24,8 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\evidence;
-use tool_lp\user_competency;
+use core_competency\evidence;
+use core_competency\user_competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index ed0faf9..5d37972 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index de7dd4d..11513d5 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 07d60ea..d8e0765 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 07038a3..69d7299 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index cca9de1..761a2b9 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index e1ad9e5..d4f6fc1 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index c11b412..89d923a 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 2227565..327c0f7 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index d804b81..620e040 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 32261f0..592dc30 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index d5f9cf8..3906153 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 5f9e557..4e33348 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 50467a3..95a3b7a 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\plan;
+use core_competency\plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index 755703b..af2677d 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\template;
+use core_competency\template;
 
 defined('MOODLE_INTERNAL') || die();
 
index 18a8083..9988634 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\template;
+use core_competency\template;
 
 defined('MOODLE_INTERNAL') || die();
 
index eb1f8da..2f30f79 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\template;
+use core_competency\template;
 
 defined('MOODLE_INTERNAL') || die();
 
index fee30ff..148de11 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\template;
+use core_competency\template;
 
 defined('MOODLE_INTERNAL') || die();
 
index 9638033..1ff1905 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index 7456236..23183fb 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency_course;
+use core_competency\user_competency_course;
 use context_course;
 defined('MOODLE_INTERNAL') || die();
 
index 5beba79..c77d999 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index 8f006bf..682a6ad 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency_plan;
+use core_competency\user_competency_plan;
 
 defined('MOODLE_INTERNAL') || die();
 
index c22b455..4f3af23 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index 128a3ff..6dae194 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index 7ab0495..86f87ff 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index e3f5e64..e883b25 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 defined('MOODLE_INTERNAL') || die();
 
 /**
index 51e9fc5..7f2cff7 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 use context_course;
 defined('MOODLE_INTERNAL') || die();
 
index 4d382ae..e6529ab 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency_course;
+use core_competency\user_competency_course;
 use context_course;
 defined('MOODLE_INTERNAL') || die();
 
index 9ad26db..5cb17c9 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 use context_course;
 defined('MOODLE_INTERNAL') || die();
 
index 0273292..d1495a5 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_evidence;
+use core_competency\user_evidence;
 
 defined('MOODLE_INTERNAL') || die();
 
index 12b8289..25fdad1 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_evidence;
+use core_competency\user_evidence;
 
 defined('MOODLE_INTERNAL') || die();
 
index d9fb342..1873d6a 100644 (file)
@@ -24,7 +24,7 @@
 namespace tool_lp\event;
 
 use core\event\base;
-use tool_lp\user_evidence;
+use core_competency\user_evidence;
 
 defined('MOODLE_INTERNAL') || die();
 
index 1335fc9..b77a274 100644 (file)
@@ -42,6 +42,23 @@ use external_multiple_structure;
 use invalid_parameter_exception;
 use required_capability_exception;
 use grade_scale;
+use \core_competency\competency;
+use \core_competency\competency_framework;
+use \core_competency\course_competency;
+use \core_competency\course_competency_settings;
+use \core_competency\course_module_competency;
+use \core_competency\evidence;
+use \core_competency\plan;
+use \core_competency\plan_competency;
+use \core_competency\related_competency;
+use \core_competency\template;
+use \core_competency\template_cohort;
+use \core_competency\template_competency;
+use \core_competency\user_competency;
+use \core_competency\user_competency_course;
+use \core_competency\user_competency_plan;
+use \core_competency\user_evidence;
+use \core_competency\user_evidence_competency;
 use tool_lp\external\competency_framework_exporter;
 use tool_lp\external\competency_summary_exporter;
 use tool_lp\external\competency_path_exporter;
index 75d0c08..fe93d97 100644 (file)
@@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
 class competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\competency';
+        return 'core_competency\\competency';
     }
 
     protected static function define_related() {
index 3987ce5..87a590a 100644 (file)
@@ -41,7 +41,7 @@ class competency_framework_exporter extends persistent_exporter {
      * @return string
      */
     protected static function define_class() {
-        return 'tool_lp\\competency_framework';
+        return 'core_competency\\competency_framework';
     }
 
     /**
index 87f9c0c..ee5ed75 100644 (file)
@@ -51,8 +51,8 @@ class competency_path_exporter extends exporter {
      */
     protected static function define_related() {
         return [
-            'ancestors' => 'tool_lp\\competency[]',
-            'framework' => 'tool_lp\\competency_framework',
+            'ancestors' => 'core_competency\\competency[]',
+            'framework' => 'core_competency\\competency_framework',
             'context' => 'context'
         ];
     }
index efe15db..bc37167 100644 (file)
@@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
 use context_course;
 use renderer_base;
 use stdClass;
-use \tool_lp\competency_framework;
+use \core_competency\competency_framework;
 
 /**
  * Class for exporting competency data with additional related data.
@@ -40,10 +40,10 @@ class competency_summary_exporter extends exporter {
     protected static function define_related() {
         // We cache the context so it does not need to be retrieved from the framework every time.
         return array('context' => '\\context',
-                     'competency' => '\\tool_lp\\competency',
-                     'framework' => '\\tool_lp\\competency_framework',
+                     'competency' => '\\core_competency\\competency',
+                     'framework' => '\\core_competency\\competency_framework',
                      'linkedcourses' => '\\stdClass[]',
-                     'relatedcompetencies' => '\\tool_lp\\competency[]');
+                     'relatedcompetencies' => '\\core_competency\\competency[]');
     }
 
     protected static function define_other_properties() {
index 9a64c98..344a828 100644 (file)
@@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
 class course_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\course_competency';
+        return 'core_competency\\course_competency';
     }
 }
index 6d08a3f..9a65f71 100644 (file)
@@ -33,7 +33,7 @@ namespace tool_lp\external;
 class course_competency_settings_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\course_competency_settings';
+        return 'core_competency\\course_competency_settings';
     }
 
 }
index b29408f..a30fd45 100644 (file)
@@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
 class course_module_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\course_module_competency';
+        return 'core_competency\\course_module_competency';
     }
 }
index 9c85c86..b556d02 100644 (file)
@@ -39,7 +39,7 @@ class evidence_exporter extends persistent_exporter {
     }
 
     protected static function define_class() {
-        return 'tool_lp\\evidence';
+        return 'core_competency\\evidence';
     }
 
     protected function get_other_values(renderer_base $output) {
index 0a71da6..9346c5d 100644 (file)
@@ -249,7 +249,7 @@ abstract class exporter {
      * export of the persistent data.
      *
      * The format of the array returned by this method has to match the structure
-     * defined in {@link \tool_lp\persistent::define_properties()}. The display properties
+     * defined in {@link \core_competency\persistent::define_properties()}. The display properties
      * can however do some more fancy things. They can define 'multiple' => true to wrap
      * values in an external_multiple_structure automatically - or they can define the
      * type as a nested array of more properties in order to generate a nested
@@ -289,7 +289,7 @@ abstract class exporter {
      * Return the list of properties.
      *
      * The format of the array returned by this method has to match the structure
-     * defined in {@link \tool_lp\persistent::define_properties()}.
+     * defined in {@link \core_competency\persistent::define_properties()}.
      *
      * @return array
      */
index 7e6d5de..db9e7cc 100644 (file)
@@ -36,16 +36,16 @@ use coding_exception;
  */
 abstract class persistent_exporter extends exporter {
 
-    /** @var \tool_lp\persistent The persistent object we will export. */
+    /** @var \core_competency\persistent The persistent object we will export. */
     protected $persistent = null;
 
     /**
      * Constructor - saves the persistent object, and the related objects.
      *
-     * @param \tool_lp\persistent $persistent The persistent object to export.
+     * @param \core_competency\persistent $persistent The persistent object to export.
      * @param array $related - An optional list of pre-loaded objects related to this persistent.
      */
-    public final function __construct(\tool_lp\persistent $persistent, $related = array()) {
+    public final function __construct(\core_competency\persistent $persistent, $related = array()) {
         $classname = static::define_class();
         if (!$persistent instanceof $classname) {
             throw new coding_exception('Invalid type for persistent. ' .
index 9c6f7d9..26348cc 100644 (file)
@@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
 class plan_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\plan_competency';
+        return 'core_competency\\plan_competency';
     }
 }
index 70f1b6b..3d999ac 100644 (file)
@@ -38,11 +38,11 @@ use moodle_url;
 class plan_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\plan';
+        return 'core_competency\\plan';
     }
 
     protected static function define_related() {
-        return array('template' => 'tool_lp\\template?');
+        return array('template' => 'core_competency\\template?');
     }
 
     protected function get_other_values(renderer_base $output) {
index ecf2a28..e0fbf28 100644 (file)
@@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
 class related_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\related_competency';
+        return 'core_competency\\related_competency';
     }
 }
index 45b0aaf..8ba41fd 100644 (file)
@@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
 class template_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\template_competency';
+        return 'core_competency\\template_competency';
     }
 }
index 2a7a394..0853dc4 100644 (file)
@@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die();
 
 use moodle_url;
 use renderer_base;
-use tool_lp\plan;
-use tool_lp\template_cohort;
+use core_competency\plan;
+use core_competency\template_cohort;
 
 /**
  * Class for exporting template data.
@@ -38,7 +38,7 @@ use tool_lp\template_cohort;
 class template_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\template';
+        return 'core_competency\\template';
     }
 
     protected function get_other_values(renderer_base $output) {
index b51c4af..5445cc1 100644 (file)
@@ -37,7 +37,7 @@ use stdClass;
 class user_competency_course_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_competency_course';
+        return 'core_competency\\user_competency_course';
     }
 
     protected static function define_related() {
index a650144..f095002 100644 (file)
@@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
 use core_user;
 use renderer_base;
 use stdClass;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 
 /**
  * Class for exporting user competency data.
@@ -38,7 +38,7 @@ use tool_lp\user_competency;
 class user_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_competency';
+        return 'core_competency\\user_competency';
     }
 
     protected static function define_related() {
index ecae607..3006169 100644 (file)
@@ -36,7 +36,7 @@ use stdClass;
 class user_competency_plan_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_competency_plan';
+        return 'core_competency\\user_competency_plan';
     }
 
     protected static function define_related() {
index 4deaaef..3f948da 100644 (file)
@@ -26,7 +26,7 @@ namespace tool_lp\external;
 use context_user;
 use renderer_base;
 use stdClass;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 
 /**
  * Class for exporting user competency data with additional related data.
@@ -38,12 +38,12 @@ class user_competency_summary_exporter extends exporter {
 
     protected static function define_related() {
         // We cache the context so it does not need to be retrieved from the framework every time.
-        return array('competency' => '\\tool_lp\\competency',
-                     'relatedcompetencies' => '\\tool_lp\\competency[]',
+        return array('competency' => '\\core_competency\\competency',
+                     'relatedcompetencies' => '\\core_competency\\competency[]',
                      'user' => '\\stdClass',
-                     'usercompetency' => '\\tool_lp\\user_competency?',
-                     'usercompetencyplan' => '\\tool_lp\\user_competency_plan?',
-                     'evidence' => '\\tool_lp\\evidence[]');
+                     'usercompetency' => '\\core_competency\\user_competency?',
+                     'usercompetencyplan' => '\\core_competency\\user_competency_plan?',
+                     'evidence' => '\\core_competency\\evidence[]');
     }
 
     protected static function define_other_properties() {
index b11e4de..e2ec69e 100644 (file)
@@ -38,12 +38,12 @@ class user_competency_summary_in_course_exporter extends exporter {
 
     protected static function define_related() {
         // We cache the context so it does not need to be retrieved from the framework every time.
-        return array('competency' => '\\tool_lp\\competency',
-                     'relatedcompetencies' => '\\tool_lp\\competency[]',
+        return array('competency' => '\\core_competency\\competency',
+                     'relatedcompetencies' => '\\core_competency\\competency[]',
                      'user' => '\\stdClass',
                      'course' => '\\stdClass',
-                     'usercompetencycourse' => '\\tool_lp\\user_competency_course?',
-                     'evidence' => '\\tool_lp\\evidence[]',
+                     'usercompetencycourse' => '\\core_competency\\user_competency_course?',
+                     'evidence' => '\\core_competency\\evidence[]',
                      'scale' => '\\grade_scale');
     }
 
index dd071be..4bd44a8 100644 (file)
@@ -37,13 +37,13 @@ class user_competency_summary_in_plan_exporter extends exporter {
 
     protected static function define_related() {
         // We cache the context so it does not need to be retrieved from the framework every time.
-        return array('competency' => '\\tool_lp\\competency',
-                     'relatedcompetencies' => '\\tool_lp\\competency[]',
+        return array('competency' => '\\core_competency\\competency',
+                     'relatedcompetencies' => '\\core_competency\\competency[]',
                      'user' => '\\stdClass',
-                     'plan' => '\\tool_lp\\plan',
-                     'usercompetency' => '\\tool_lp\\user_competency?',
-                     'usercompetencyplan' => '\\tool_lp\\user_competency_plan?',
-                     'evidence' => '\\tool_lp\\evidence[]');
+                     'plan' => '\\core_competency\\plan',
+                     'usercompetency' => '\\core_competency\\user_competency?',
+                     'usercompetencyplan' => '\\core_competency\\user_competency_plan?',
+                     'evidence' => '\\core_competency\\evidence[]');
     }
 
     protected static function define_other_properties() {
index f2a103a..b12d425 100644 (file)
@@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
 class user_evidence_competency_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_evidence_competency';
+        return 'core_competency\\user_evidence_competency';
     }
 
 }
index 07f7da6..cee50a8 100644 (file)
@@ -35,8 +35,8 @@ use renderer_base;
 class user_evidence_competency_summary_exporter extends exporter {
 
     protected static function define_related() {
-        return array('competency' => '\\tool_lp\\competency',
-                     'usercompetency' => '\\tool_lp\\user_competency',
+        return array('competency' => '\\core_competency\\competency',
+                     'usercompetency' => '\\core_competency\\user_competency',
                      'scale' => 'grade_scale',
                      'context' => '\\context'
                     );
index 1cd220f..d807716 100644 (file)
@@ -36,7 +36,7 @@ use renderer_base;
 class user_evidence_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_evidence';
+        return 'core_competency\\user_evidence';
     }
 
     protected static function define_other_properties() {
@@ -70,7 +70,7 @@ class user_evidence_exporter extends persistent_exporter {
     protected static function define_related() {
         return array(
             'context' => 'context',
-            'competencies' => 'tool_lp\\competency[]'
+            'competencies' => 'core_competency\\competency[]'
         );
     }
 
index 360e900..a1c5d33 100644 (file)
@@ -38,7 +38,7 @@ use tool_lp\external\user_evidence_competency_summary_exporter;
 class user_evidence_summary_exporter extends persistent_exporter {
 
     protected static function define_class() {
-        return 'tool_lp\\user_evidence';
+        return 'core_competency\\user_evidence';
     }
 
     protected static function define_other_properties() {
index 0618b41..da943c8 100644 (file)
@@ -36,7 +36,7 @@ use stdClass;
  */
 class competency extends persistent {
 
-    protected static $persistentclass = 'tool_lp\\competency';
+    protected static $persistentclass = 'core_competency\\competency';
 
     /**
      * Define the form - called by parent constructor
index 84e2c96..c60ecdd 100644 (file)
@@ -36,7 +36,7 @@ use stdClass;
  */
 class competency_framework extends persistent {
 
-    protected static $persistentclass = 'tool_lp\\competency_framework';
+    protected static $persistentclass = 'core_competency\\competency_framework';
 
     /**
      * Define the form - called by parent constructor
@@ -95,11 +95,11 @@ class competency_framework extends persistent {
         $mform->setDefault('context', $context->get_context_name(false));
 
         $mform->addElement('header', 'taxonomyhdr', get_string('taxonomies', 'tool_lp'));
-        $taxonomies = \tool_lp\competency_framework::get_taxonomies_list();
+        $taxonomies = \core_competency\competency_framework::get_taxonomies_list();
         $taxdefaults = array();
-        for ($i = 1; $i <= \tool_lp\competency_framework::get_taxonomies_max_level(); $i++) {
+        for ($i = 1; $i <= \core_competency\competency_framework::get_taxonomies_max_level(); $i++) {
             $mform->addElement('select', "taxonomies[$i]", get_string('levela', 'tool_lp', $i), $taxonomies);
-            $taxdefaults[$i] = \tool_lp\competency_framework::TAXONOMY_COMPETENCY;
+            $taxdefaults[$i] = \core_competency\competency_framework::TAXONOMY_COMPETENCY;
         }
         // Not using taxonomies[n] here or it would takes precedence over set_data(array('taxonomies' => ...)).
         $mform->setDefault('taxonomies', $taxdefaults);
index 59f78f7..8a3e856 100644 (file)
@@ -27,7 +27,7 @@ namespace tool_lp\form;
 
 use coding_exception;
 use MoodleQuickForm_autocomplete;
-use \tool_lp\competency_framework;
+use \core_competency\competency_framework;
 
 global $CFG;
 require_once($CFG->libdir . '/form/autocomplete.php');
index 5a6b947..9d1438e 100644 (file)
@@ -85,7 +85,7 @@ abstract class persistent extends moodleform {
             $attributes = null, $editable = true) {
         if (empty(static::$persistentclass)) {
             throw new coding_exception('Static property $persistentclass must be set.');
-        } else if (!is_subclass_of(static::$persistentclass, 'tool_lp\\persistent')) {
+        } else if (!is_subclass_of(static::$persistentclass, 'core_competency\\persistent')) {
             throw new coding_exception('Static property $persistentclass is not valid.');
         } else if (!array_key_exists('persistent', $customdata)) {
             throw new coding_exception('The custom data \'persistent\' key must be set, even if it is null.');
index ce0593d..54604ee 100644 (file)
@@ -25,7 +25,7 @@
 namespace tool_lp\form;
 defined('MOODLE_INTERNAL') || die();
 
-use tool_lp\plan as planpersistent;
+use core_competency\plan as planpersistent;
 use required_capability_exception;
 
 /**
@@ -37,7 +37,7 @@ use required_capability_exception;
  */
 class plan extends persistent {
 
-    protected static $persistentclass = 'tool_lp\\plan';
+    protected static $persistentclass = 'core_competency\\plan';
 
     /**
      * Define the form - called by parent constructor
index a593907..e5f6940 100644 (file)
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  */
 class template extends persistent {
 
-    protected static $persistentclass = 'tool_lp\\template';
+    protected static $persistentclass = 'core_competency\\template';
 
     /**
      * Define the form - called by parent constructor
index d8ec499..7741444 100644 (file)
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
  */
 class user_evidence extends persistent {
 
-    protected static $persistentclass = 'tool_lp\\user_evidence';
+    protected static $persistentclass = 'core_competency\\user_evidence';
 
     protected static $foreignfields = array('files');
 
index b41a995..25a6d06 100644 (file)
@@ -39,13 +39,13 @@ use tool_lp\external\competency_summary_exporter;
  */
 class competency_summary implements renderable, templatable {
 
-    /** @var \tool_lp\competency_framework $framework This competency framework. */
+    /** @var \core_competency\competency_framework $framework This competency framework. */
     protected $framework = null;
 
-    /** @var \tool_lp\competency $competency. */
+    /** @var \core_competency\competency $competency. */
     protected $competency = null;
 
-    /** @var \tool_lp\competency[] $relatedcompetencies List of competencies. */
+    /** @var \core_competency\competency[] $relatedcompetencies List of competencies. */
     protected $relatedcompetencies = array();
 
     /** @var course[] $courses List of courses. */
@@ -54,8 +54,8 @@ class competency_summary implements renderable, templatable {
     /**
      * Construct this renderable.
      *
-     * @param \tool_lp\competency $competency Competency persistent.
-     * @param \tool_lp\competency_framework $framework framework persistent.
+     * @param \core_competency\competency $competency Competency persistent.
+     * @param \core_competency\competency_framework $framework framework persistent.
      * @param boolean $includerelated Include or not related competencies.
      * @param boolean $includecourses Include or not competency courses.
      */
index 362974b..83cf933 100644 (file)
@@ -32,9 +32,9 @@ use moodle_url;
 use context_system;
 use context_course;
 use tool_lp\api;
-use tool_lp\course_competency;
-use tool_lp\course_competency_statistics;
-use tool_lp\competency;
+use core_competency\course_competency;
+use core_competency\course_competency_statistics;
+use core_competency\competency;
 use tool_lp\external\competency_exporter;
 use tool_lp\external\competency_path_exporter;
 use tool_lp\external\course_competency_exporter;
@@ -58,7 +58,7 @@ class course_competencies_page implements renderable, templatable {
     /** @var context $context The context for this page. */
     protected $context = null;
 
-    /** @var \tool_lp\course_competency[] $competencies List of competencies. */
+    /** @var \core_competency\course_competency[] $competencies List of competencies. */
     protected $coursecompetencylist = array();
 
     /** @var bool $canmanagecompetencyframeworks Can the current user manage competency frameworks. */
index 370c563..f7fdd67 100644 (file)
@@ -32,8 +32,8 @@ use stdClass;
 use moodle_url;
 use context_system;
 use tool_lp\api;
-use tool_lp\competency;
-use tool_lp\competency_framework;
+use core_competency\competency;
+use core_competency\competency_framework;
 use tool_lp\external\competency_framework_exporter;
 
 /**
@@ -44,10 +44,10 @@ use tool_lp\external\competency_framework_exporter;
  */
 class manage_competencies_page implements renderable, templatable {
 
-    /** @var \tool_lp\competency_framework $framework This competency framework. */
+    /** @var \core_competency\competency_framework $framework This competency framework. */
     protected $framework = null;
 
-    /** @var \tool_lp\competency[] $competencies List of competencies. */
+    /** @var \core_competency\competency[] $competencies List of competencies. */
     protected $competencies = array();
 
     /** @var string $search Text to search for. */
@@ -65,7 +65,7 @@ class manage_competencies_page implements renderable, templatable {
     /**
      * Construct this renderable.
      *
-     * @param \tool_lp\competency_framework $framework Competency framework.
+     * @param \core_competency\competency_framework $framework Competency framework.
      * @param string $search Search string.
      * @param context $pagecontext The page context.
      */
index 967c6f4..2594bb4 100644 (file)
@@ -33,7 +33,7 @@ use moodle_url;
 use context;
 use context_system;
 use tool_lp\api;
-use tool_lp\competency_framework;
+use core_competency\competency_framework;
 use tool_lp\external\competency_framework_exporter;
 
 /**
index 5e9e524..ec132dc 100644 (file)
@@ -33,7 +33,7 @@ use stdClass;
 use moodle_url;
 use context_system;
 use tool_lp\api;
-use tool_lp\template;
+use core_competency\template;
 use tool_lp\external\template_exporter;
 
 /**
index 4ed7b71..cbd32c3 100644 (file)
@@ -29,7 +29,7 @@ use templatable;
 use stdClass;
 use moodle_url;
 use tool_lp\api;
-use tool_lp\plan;
+use core_competency\plan;
 use tool_lp\external\competency_exporter;
 use tool_lp\external\competency_path_exporter;
 use tool_lp\external\plan_exporter;
index b60b1f8..0a7e8df 100644 (file)
@@ -32,8 +32,8 @@ use single_button;
 use moodle_url;
 use tool_lp\api;
 use tool_lp\external\plan_exporter;
-use tool_lp\plan;
-use tool_lp\user_evidence;
+use core_competency\plan;
+use core_competency\user_evidence;
 use context_user;
 
 /**
@@ -47,7 +47,7 @@ class plans_page implements renderable, templatable {
     /** @var array $navigation List of links to display on the page. Each link contains a url and a title. */
     protected $navigation = array();
 
-    /** @var array|\tool_lp\plan[] $plans List of plans. */
+    /** @var array|\core_competency\plan[] $plans List of plans. */
     protected $plans = array();
 
     /** @var context_user|null $context context.  */
@@ -88,7 +88,7 @@ class plans_page implements renderable, templatable {
         $data->canreaduserevidence = user_evidence::can_read_user($this->userid);
         $data->canmanageuserplans = plan::can_manage_user($this->userid);
 
-        // Attach standard objects as mustache can not parse \tool_lp\plan objects.
+        // Attach standard objects as mustache can not parse \core_competency\plan objects.
         $data->plans = array();
         if ($this->plans) {
             foreach ($this->plans as $plan) {
index bcadd93..0964778 100644 (file)
@@ -36,10 +36,10 @@ class template_cohorts_page implements \renderable {
 
     /**
      * Constructor.
-     * @param \tool_lp\template $template
+     * @param \core_competency\template $template
      * @param \moodle_url $url
      */
-    public function __construct(\tool_lp\template $template, \moodle_url $url) {
+    public function __construct(\core_competency\template $template, \moodle_url $url) {
         $this->template = $template;
         $this->url = $url;
         $this->table = new template_cohorts_table('tplcohorts', $template);
index 878fc52..dda4172 100644 (file)
@@ -30,7 +30,7 @@ require_once($CFG->libdir . '/tablelib.php');
 use html_writer;
 use moodle_url;
 use table_sql;
-use tool_lp\template;
+use core_competency\template;
 
 /**
  * Template cohorts table class.
@@ -47,16 +47,16 @@ class template_cohorts_table extends table_sql {
     /** @var context The context. */
     protected $context;
 
-    /** @var \tool_lp\template The template. */
+    /** @var \core_competency\template The template. */
     protected $template;
 
     /**
      * Sets up the table.
      *
      * @param string $uniqueid Unique id of table.
-     * @param \tool_lp\template $template The template.
+     * @param \core_competency\template $template The template.
      */
-    public function __construct($uniqueid, \tool_lp\template $template) {
+    public function __construct($uniqueid, \core_competency\template $template) {
         parent::__construct($uniqueid);
 
          // This object should not be used without the right permissions.
@@ -138,7 +138,7 @@ class template_cohorts_table extends table_sql {
         }
 
         $sql = "SELECT $select
-                  FROM {" . \tool_lp\template_cohort::TABLE . "} tc
+                  FROM {" . \core_competency\template_cohort::TABLE . "} tc
                   JOIN {cohort} c ON c.id = tc.cohortid
                  WHERE tc.templateid = :templateid";
         $params = array('templateid' => $this->template->get_id());
index b444e17..6bcde1e 100644 (file)
@@ -33,8 +33,8 @@ use context_system;
 use moodle_url;
 use tool_lp\api;
 use tool_lp\external\competency_summary_exporter;
-use tool_lp\template;
-use tool_lp\template_statistics;
+use core_competency\template;
+use core_competency\template_statistics;
 use tool_lp\external\template_exporter;
 use tool_lp\external\template_statistics_exporter;
 
@@ -49,7 +49,7 @@ class template_competencies_page implements renderable, templatable {
     /** @var template $template Template for this page. */
     protected $template = null;
 
-    /** @var \tool_lp\competency[] $competencies List of competencies. */
+    /** @var \core_competency\competency[] $competencies List of competencies. */
     protected $competencies = array();
 
     /** @var bool $canmanagecompetencyframeworks Can the current user manage competency frameworks. */
index f01d99f..0042b7f 100644 (file)
@@ -36,10 +36,10 @@ class template_plans_page implements \renderable {
 
     /**
      * Constructor.
-     * @param \tool_lp\template $template
+     * @param \core_competency\template $template
      * @param \moodle_url $url
      */
-    public function __construct(\tool_lp\template $template, \moodle_url $url) {
+    public function __construct(\core_competency\template $template, \moodle_url $url) {
         $this->template = $template;
         $this->url = $url;
         $this->table = new template_plans_table('tplplans', $template);
index 28636e3..09b3adc 100644 (file)
@@ -30,7 +30,7 @@ require_once($CFG->libdir . '/tablelib.php');
 use html_writer;
 use moodle_url;
 use table_sql;
-use tool_lp\template;
+use core_competency\template;
 
 /**
  * Template plans table class.
@@ -47,16 +47,16 @@ class template_plans_table extends table_sql {
     /** @var context The context. */
     protected $context;
 
-    /** @var \tool_lp\template The template. */
+    /** @var \core_competency\template The template. */
     protected $template;
 
     /**
      * Sets up the table.
      *
      * @param string $uniqueid Unique id of table.
-     * @param \tool_lp\template $template The template.
+     * @param \core_competency\template $template The template.
      */
-    public function __construct($uniqueid, \tool_lp\template $template) {
+    public function __construct($uniqueid, \core_competency\template $template) {
         parent::__construct($uniqueid);
 
         // This object should not be used without the right permissions.
@@ -147,7 +147,7 @@ class template_plans_table extends table_sql {
         }
 
         $sql = "SELECT $select
-                  FROM {" . \tool_lp\plan::TABLE . "} p
+                  FROM {" . \core_competency\plan::TABLE . "} p
                   JOIN {user} u ON u.id = p.userid
                  WHERE p.templateid = :templateid";
         $params = array('templateid' => $this->template->get_id());
index 6621898..a0a9244 100644 (file)
@@ -29,7 +29,7 @@ use renderer_base;
 use renderable;
 use templatable;
 use tool_lp\api;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 use tool_lp\external\user_competency_summary_exporter;
 
 /**
index 44b1113..a0e82b8 100644 (file)
@@ -27,7 +27,7 @@ use renderable;
 use renderer_base;
 use templatable;
 use tool_lp\api;
-use tool_lp\user_competency;
+use core_competency\user_competency;
 use tool_lp\external\user_competency_summary_in_course_exporter;
 
 /**
index 4f22eb1..8ccdaec 100644 (file)
@@ -31,7 +31,7 @@ use single_button;
 use moodle_url;
 use tool_lp\api;
 use tool_lp\external\user_evidence_summary_exporter;
-use tool_lp\user_evidence;
+use core_competency\user_evidence;
 use context_user;
 
 /**
index afa494d..121cf80 100644 (file)
@@ -99,7 +99,7 @@ class page_helper {
      *
      * @param  int $pagecontextid The page context ID.
      * @param  moodle_url $url The current page.
-     * @param  \tool_lp\template $template The template, if any.
+     * @param  \core_competency\template $template The template, if any.
      * @param  string $subtitle The title of the subpage, if any.
      * @param  string $returntype The desired return page.
      * @return array With the following:
@@ -177,7 +177,7 @@ class page_helper {
      *
      * @param  int $userid The user ID.
      * @param  moodle_url $url The current page.
-     * @param  \tool_lp\plan $plan The plan, if any.
+     * @param  \core_competency\plan $plan The plan, if any.
      * @param  string $subtitle The title of the subpage, if any.
      * @param  string $returntype The desired return page.
      * @return array With the following:
@@ -251,7 +251,7 @@ class page_helper {
      *
      * @param  int $userid The user ID.
      * @param  moodle_url $url The current page.
-     * @param  \tool_lp\user_evidence $evidence The user evidence, if any.
+     * @param  \core_competency\user_evidence $evidence The user evidence, if any.
      * @param  string $subtitle The title of the subpage, if any.
      * @param  string $returntype The desired return page.
      * @return array With the following:
@@ -325,7 +325,7 @@ class page_helper {
      *
      * @param  int $id The framework ID.
      * @param  int $pagecontextid The page context ID.
-     * @param  \tool_lp\competency_framework $framework The framework.
+     * @param  \core_competency\competency_framework $framework The framework.
      * @param  string $returntype The desired return page.
      * @return array With the following:
      *               - Page title
@@ -385,9 +385,9 @@ class page_helper {
      *
      * @param  int $pagecontextid The page context ID.
      * @param  moodle_url $url The current page.
-     * @param  \tool_lp\competency_framework $framework The competency framework.
-     * @param  \tool_lp\competency $competency The competency, if any.
-     * @param  \tool_lp\competency $parent The parent competency, if any.
+     * @param  \core_competency\competency_framework $framework The competency framework.
+     * @param  \core_competency\competency $competency The competency, if any.
+     * @param  \core_competency\competency $parent The parent competency, if any.
      * @return array With the following:
      *               - Page title
      *               - Page sub title
index 623804e..4b80e5b 100644 (file)
 namespace tool_lp;
 defined('MOODLE_INTERNAL') || die();
 
+use core_competency\api;
+use core_competency\plan;
+use core_competency\template;
+
 /**
  * Template statistics class.
  *
index 14ba787..ebc9d95 100644 (file)
@@ -36,7 +36,7 @@ $pagecontext = context::instance_by_id($pagecontextid);
 $framework = \tool_lp\api::read_framework($id);
 $context = $framework->get_context();
 
-if (!\tool_lp\competency_framework::can_read_context($context)) {
+if (!\core_competency\competency_framework::can_read_context($context)) {
     throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
 }
 
index e248c7c..9a9a0a4 100644 (file)
@@ -34,7 +34,7 @@ $url->param('pagecontextid', $pagecontextid);
 require_login();
 \tool_lp\api::require_enabled();
 
-if (!\tool_lp\competency_framework::can_read_context($context)) {
+if (!\core_competency\competency_framework::can_read_context($context)) {
     throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
 }
 
index 1d6b491..4b641a8 100644 (file)
@@ -28,10 +28,10 @@ defined('MOODLE_INTERNAL') || die();
 $observers = array(
     array(
         'eventname'   => '\\core\\event\\course_completed',
-        'callback'    => '\\tool_lp\\api::observe_course_completed',
+        'callback'    => '\\core_competency\\api::observe_course_completed',
     ),
     array(
         'eventname'   => '\\core\\event\\course_module_completion_updated',
-        'callback'    => '\\tool_lp\\api::observe_course_module_completion_updated',
+        'callback'    => '\\core_competency\\api::observe_course_module_completion_updated',
     ),
 );
index 983520e..7d4d38e 100644 (file)
@@ -32,7 +32,7 @@ $pagecontextid = required_param('pagecontextid', PARAM_INT);  // Reference to wh
 $framework = null;
 if (!empty($id)) {
     // Always use the context from the framework when it exists.
-    $framework = new \tool_lp\competency_framework($id);
+    $framework = new \core_competency\competency_framework($id);
     $context = $framework->get_context();
 } else {
     $context = context::instance_by_id($pagecontextid);
index be414b6..d77d146 100644 (file)
@@ -57,7 +57,7 @@ $customdata = array('userid' => $userid, 'context' => $PAGE->context, 'persisten
 
 // User can create plan if he can_manage_user with active/complete status
 // or if he can_manage_user_draft with draft status.
-$cancreate = \tool_lp\plan::can_manage_user_draft($userid) || \tool_lp\plan::can_manage_user($userid);
+$cancreate = \core_competency\plan::can_manage_user_draft($userid) || \core_competency\plan::can_manage_user($userid);
 
 // If editing plan, check if user has permissions to edit it.
 if ($plan != null) {
index 820c7a0..f5eaaba 100644 (file)
@@ -32,7 +32,7 @@ $pagecontextid = required_param('pagecontextid', PARAM_INT);  // Reference to wh
 $template = null;
 if (!empty($id)) {
     // Always use the context from the framework when it exists.
-    $template = new \tool_lp\template($id);
+    $template = new \core_competency\template($id);
     $context = $template->get_context();
 } else {
     $context = context::instance_by_id($pagecontextid);
index dfdd9ba..bdacec4 100644 (file)
@@ -30,7 +30,7 @@ $context = context::instance_by_id($pagecontextid);
 
 require_login(0, false);
 \tool_lp\api::require_enabled();
-if (!\tool_lp\template::can_read_context($context)) {
+if (!\core_competency\template::can_read_context($context)) {
     throw new required_capability_exception($context, 'moodle/competency:templateview', 'nopermissions', '');
 }
 
index 008abec..ecacd04 100644 (file)
@@ -66,11 +66,11 @@ function tool_lp_extend_navigation_user($navigation, $user, $usercontext, $cours
         return;
     }
 
-    if (\tool_lp\plan::can_read_user($user->id)) {
+    if (\core_competency\plan::can_read_user($user->id)) {
         $node = $navigation->add(get_string('learningplans', 'tool_lp'),
             new moodle_url('/admin/tool/lp/plans.php', array('userid' => $user->id)));
 
-        if (\tool_lp\user_evidence::can_read_user($user->id)) {
+        if (\core_competency\user_evidence::can_read_user($user->id)) {
             $node->add(get_string('userevidence', 'tool_lp'),
                 new moodle_url('/admin/tool/lp/user_evidence_list.php', array('userid' => $user->id)));
         }
@@ -91,7 +91,7 @@ function tool_lp_extend_navigation_user($navigation, $user, $usercontext, $cours
 function tool_lp_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
     if (!\tool_lp\api::is_enabled()) {
         return false;
-    } else if (!\tool_lp\plan::can_read_user($user->id)) {
+    } else if (!\core_competency\plan::can_read_user($user->id)) {
         return false;
     }
 
@@ -115,8 +115,8 @@ function tool_lp_extend_navigation_category_settings($navigation, $coursecategor
     }
 
     // We check permissions before renderring the links.
-    $templatereadcapability = \tool_lp\template::can_read_context($coursecategorycontext);
-    $competencyreadcapability = \tool_lp\competency_framework::can_read_context($coursecategorycontext);
+    $templatereadcapability = \core_competency\template::can_read_context($coursecategorycontext);
+    $competencyreadcapability = \core_competency\competency_framework::can_read_context($coursecategorycontext);
     if (!$templatereadcapability && !$competencyreadcapability) {
         return false;
     }
@@ -180,7 +180,7 @@ function tool_lp_pluginfile($course, $cm, $context, $filearea, $args, $forcedown
     $filepath = $args ? '/' .implode('/', $args) . '/' : '/';
 
     if ($filearea == 'userevidence' && $context->contextlevel == CONTEXT_USER) {
-        if (\tool_lp\user_evidence::can_read_user($context->instanceid)) {
+        if (\core_competency\user_evidence::can_read_user($context->instanceid)) {
             $file = $fs->get_file($context->id, 'tool_lp', $filearea, $itemid, $filepath, $filename);
         }
     }
@@ -207,7 +207,7 @@ function tool_lp_comment_add($comment, $params) {
     }
 
     if ($params->commentarea == 'user_competency') {
-        $uc = new \tool_lp\user_competency($params->itemid);
+        $uc = new \core_competency\user_competency($params->itemid);
 
         // Message both the user and the reviewer, except when they are the author of the message.
         $recipients = array($uc->get_userid());
@@ -234,7 +234,7 @@ function tool_lp_comment_add($comment, $params) {
         $plan = null;
         $plans = $uc->get_plans();
         foreach ($plans as $candidate) {
-            if ($candidate->get_status() == \tool_lp\plan::STATUS_ACTIVE) {
+            if ($candidate->get_status() == \core_competency\plan::STATUS_ACTIVE) {
                 $plan = $candidate;
                 break;
 
@@ -305,7 +305,7 @@ function tool_lp_comment_add($comment, $params) {
         }
 
     } else if ($params->commentarea == 'plan') {
-        $plan = new \tool_lp\plan($params->itemid);
+        $plan = new \core_competency\plan($params->itemid);
 
         // Message both the user and the reviewer, except when they are the author of the message.
         $recipients = array($plan->get_userid());
@@ -388,12 +388,12 @@ function tool_lp_comment_permissions($params) {
     }
 
     if ($params->commentarea == 'user_competency') {
-        $uc = new \tool_lp\user_competency($params->itemid);
+        $uc = new \core_competency\user_competency($params->itemid);
         if ($uc->can_read()) {
             return array('post' => $uc->can_comment(), 'view' => $uc->can_read_comments());
         }
     } else if ($params->commentarea == 'plan') {
-        $plan = new \tool_lp\plan($params->itemid);
+        $plan = new \core_competency\plan($params->itemid);
         if ($plan->can_read()) {
             return array('post' => $plan->can_comment(), 'view' => $plan->can_read_comments());
         }
@@ -414,12 +414,12 @@ function tool_lp_comment_validate($params) {
     }
 
     if ($params->commentarea == 'user_competency') {
-        if (!\tool_lp\user_competency::record_exists($params->itemid)) {
+        if (!\core_competency\user_competency::record_exists($params->itemid)) {
             return false;
         }
         return true;
     } else if ($params->commentarea == 'plan') {
-        if (!\tool_lp\plan::record_exists($params->itemid)) {
+        if (!\core_competency\plan::record_exists($params->itemid)) {
             return false;
         }
         return true;
@@ -482,7 +482,7 @@ function tool_lp_coursemodule_edit_post_actions($data, $course) {
 
     // We bypass the API here and go direct to the persistent layer - because we don't want to do permission
     // checks here - we need to load the real list of existing course module competencies.
-    $existing = \tool_lp\course_module_competency::list_course_module_competencies($data->coursemodule);
+    $existing = \core_competency\course_module_competency::list_course_module_competencies($data->coursemodule);
 
     $existingids = array();
     foreach ($existing as $cmc) {
index 23dc529..424be32 100644 (file)
@@ -68,7 +68,7 @@ if ($canmanagetemplate && ($data = $form->get_data()) && !empty($data->cohorts))
         if ($template->get_visible() && $i < $maxtocreate && !$duedatereached) {
 
             // Only create a few plans right now.
-            $tocreate = \tool_lp\template_cohort::get_missing_plans($template->get_id(), $cohortid);
+            $tocreate = \core_competency\template_cohort::get_missing_plans($template->get_id(), $cohortid);
             if ($i + count($tocreate) <= $maxtocreate) {
                 $i += \tool_lp\api::create_plans_from_template_cohort($template, $cohortid);
             } else {
index 7731b2d..b6bc8e9 100644 (file)
@@ -26,12 +26,12 @@ defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
 use tool_lp\api;
-use tool_lp\competency;
-use tool_lp\competency_framework;
-use tool_lp\course_competency_settings;
-use tool_lp\evidence;
-use tool_lp\user_competency;
-use tool_lp\plan;
+use core_competency\competency;
+use core_competency\competency_framework;
+use core_competency\course_competency_settings;
+use core_competency\evidence;
+use core_competency\user_competency;
+use core_competency\plan;
 
 /**
  * API tests.
@@ -320,8 +320,8 @@ class tool_lp_api_testcase extends advanced_testcase {
                 array('id' => $competency42->get_id(), 'points' => 2, 'required' => 1),
             )
         ));
-        $competency4->set_ruletype('tool_lp\competency_rule_points');
-        $competency4->set_ruleoutcome(\tool_lp\competency::OUTCOME_EVIDENCE);
+        $competency4->set_ruletype('core_competency\competency_rule_points');
+        $competency4->set_ruleoutcome(\core_competency\competency::OUTCOME_EVIDENCE);
         $competency4->set_ruleconfig($config);
         $competency4->update();
 
@@ -447,10 +447,10 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // Check if user create draft can edit the plan name.
         $plan = api::update_plan($record);
-        $this->assertInstanceOf('\tool_lp\plan', $plan);
+        $this->assertInstanceOf('\core_competency\plan', $plan);
 
         // The status cannot be changed in this method.
-        $record->status = \tool_lp\plan::STATUS_ACTIVE;
+        $record->status = \core_competency\plan::STATUS_ACTIVE;
         try {
             $plan = api::update_plan($record);
             $this->fail('Updating the status is not allowed.');
@@ -459,7 +459,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         }
 
         // Test when user with manage own plan capability try to edit other user plan.
-        $record->status = \tool_lp\plan::STATUS_DRAFT;
+        $record->status = \core_competency\plan::STATUS_DRAFT;
         $record->name = 'plan create draft modified 2';
         $this->setUser($usermanageown);
         try {
@@ -481,10 +481,10 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // User with manage draft capability can edit other user's learning plan if the status is draft.
         $this->setUser($usermanagedraft);
-        $record->status = \tool_lp\plan::STATUS_DRAFT;
+        $record->status = \core_competency\plan::STATUS_DRAFT;
         $record->name = 'plan manage draft modified 3';
         $plan = api::update_plan($record);
-        $this->assertInstanceOf('\tool_lp\plan', $plan);
+        $this->assertInstanceOf('\core_competency\plan', $plan);
 
         // User with manage  plan capability can create/edit learning plan if status is active/complete.
         $this->setUser($usermanage);
@@ -492,12 +492,12 @@ class tool_lp_api_testcase extends advanced_testcase {
             'name' => 'plan create',
             'description' => 'plan create',
             'userid' => $usermanage->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE
+            'status' => \core_competency\plan::STATUS_ACTIVE
         );
         $plan = api::create_plan((object)$plan);
 
         // Silently transition to complete status to avoid errors about transitioning to complete.
-        $plan->set_status(\tool_lp\plan::STATUS_COMPLETE);
+        $plan->set_status(\core_competency\plan::STATUS_COMPLETE);
         $plan->update();
 
         $record = $plan->to_record();
@@ -520,8 +520,8 @@ class tool_lp_api_testcase extends advanced_testcase {
         // Creating a new plan.
         $plan = api::create_plan_from_template($tpl, $u1->id);
         $record = $plan->to_record();
-        $this->assertInstanceOf('\tool_lp\plan', $plan);
-        $this->assertTrue(\tool_lp\plan::record_exists($plan->get_id()));
+        $this->assertInstanceOf('\core_competency\plan', $plan);
+        $this->assertTrue(\core_competency\plan::record_exists($plan->get_id()));
         $this->assertEquals($tpl->get_id(), $plan->get_templateid());
         $this->assertEquals($u1->id, $plan->get_userid());
         $this->assertTrue($plan->is_based_on_template());
@@ -608,16 +608,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $plan3 = $lpg->create_plan(array('userid' => $u1->id, 'templateid' => $tpl1->get_id(), 'status' => plan::STATUS_COMPLETE));
 
         // Check that we have what we expect at this stage.
-        $this->assertEquals(2, \tool_lp\template_competency::count_records(array('templateid' => $tpl1->get_id())));
-        $this->assertEquals(1, \tool_lp\template_competency::count_records(array('templateid' => $tpl2->get_id())));
-        $this->assertEquals(0, \tool_lp\plan_competency::count_records(array('planid' => $plan1->get_id())));
-        $this->assertEquals(0, \tool_lp\plan_competency::count_records(array('planid' => $plan2->get_id())));
+        $this->assertEquals(2, \core_competency\template_competency::count_records(array('templateid' => $tpl1->get_id())));
+        $this->assertEquals(1, \core_competency\template_competency::count_records(array('templateid' => $tpl2->get_id())));
+        $this->assertEquals(0, \core_competency\plan_competency::count_records(array('planid' => $plan1->get_id())));
+        $this->assertEquals(0, \core_competency\plan_competency::count_records(array('planid' => $plan2->get_id())));
         $this->assertTrue($plan1->is_based_on_template());
         $this->assertTrue($plan2->is_based_on_template());
 
         // Let's do this!
-        $tpl1comps = \tool_lp\template_competency::list_competencies($tpl1->get_id(), true);
-        $tpl2comps = \tool_lp\template_competency::list_competencies($tpl2->get_id(), true);
+        $tpl1comps = \core_competency\template_competency::list_competencies($tpl1->get_id(), true);
+        $tpl2comps = \core_competency\template_competency::list_competencies($tpl2->get_id(), true);
 
         api::unlink_plan_from_template($plan1);
 
@@ -625,10 +625,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $plan2->read();
         $this->assertCount(2, $tpl1comps);
         $this->assertCount(1, $tpl2comps);
-        $this->assertEquals(2, \tool_lp\template_competency::count_records(array('templateid' => $tpl1->get_id())));
-        $this->assertEquals(1, \tool_lp\template_competency::count_records(array('templateid' => $tpl2->get_id())));
-        $this->assertEquals(2, \tool_lp\plan_competency::count_records(array('planid' => $plan1->get_id())));
-        $this->assertEquals(0, \tool_lp\plan_competency::count_records(array('planid' => $plan2->get_id())));
+        $this->assertEquals(2, \core_competency\template_competency::count_records(array('templateid' => $tpl1->get_id())));
+        $this->assertEquals(1, \core_competency\template_competency::count_records(array('templateid' => $tpl2->get_id())));
+        $this->assertEquals(2, \core_competency\plan_competency::count_records(array('planid' => $plan1->get_id())));
+        $this->assertEquals(0, \core_competency\plan_competency::count_records(array('planid' => $plan2->get_id())));
         $this->assertFalse($plan1->is_based_on_template());
         $this->assertEquals($tpl1->get_id(), $plan1->get_origtemplateid());
         $this->assertTrue($plan2->is_based_on_template());
@@ -650,7 +650,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         }
 
         // Even the order remains.
-        $plan1comps = \tool_lp\plan_competency::list_competencies($plan1->get_id());
+        $plan1comps = \core_competency\plan_competency::list_competencies($plan1->get_id());
         $before = reset($tpl1comps);
         $after = reset($plan1comps);
         $this->assertEquals($before->get_id(), $after->get_id());
@@ -786,17 +786,17 @@ class tool_lp_api_testcase extends advanced_testcase {
                 'proficiency' => false, 'grade' => 2 ))
         );
 
-        $this->assertEquals(2, \tool_lp\user_competency::count_records());
-        $this->assertEquals(0, \tool_lp\user_competency_plan::count_records());
+        $this->assertEquals(2, \core_competency\user_competency::count_records());
+        $this->assertEquals(0, \core_competency\user_competency_plan::count_records());
 
         // Change status of the plan to complete.
         api::complete_plan($plan);
 
         // Check that user competencies are now in user_competency_plan objects and still in user_competency.
-        $this->assertEquals(2, \tool_lp\user_competency::count_records());
-        $this->assertEquals(3, \tool_lp\user_competency_plan::count_records());
+        $this->assertEquals(2, \core_competency\user_competency::count_records());
+        $this->assertEquals(3, \core_competency\user_competency_plan::count_records());
 
-        $usercompetenciesplan = \tool_lp\user_competency_plan::get_records();
+        $usercompetenciesplan = \core_competency\user_competency_plan::get_records();
 
         $this->assertEquals($uclist[0]->get_userid(), $usercompetenciesplan[0]->get_userid());
         $this->assertEquals($uclist[0]->get_competencyid(), $usercompetenciesplan[0]->get_competencyid());
@@ -1535,7 +1535,7 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // Change status of the plan to complete.
         $record = $plan->to_record();
-        $record->status = \tool_lp\plan::STATUS_COMPLETE;
+        $record->status = \core_competency\plan::STATUS_COMPLETE;
 
         try {
             $plan = api::update_plan($record);
@@ -1546,10 +1546,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         api::complete_plan($plan);
 
         // Check that user compretencies are now in user_competency_plan objects and still in user_competency.
-        $this->assertEquals(2, \tool_lp\user_competency::count_records());
-        $this->assertEquals(3, \tool_lp\user_competency_plan::count_records());
+        $this->assertEquals(2, \core_competency\user_competency::count_records());
+        $this->assertEquals(3, \core_competency\user_competency_plan::count_records());
 
-        $usercompetenciesplan = \tool_lp\user_competency_plan::get_records();
+        $usercompetenciesplan = \core_competency\user_competency_plan::get_records();
 
         $this->assertEquals($uclist[0]->get_userid(), $usercompetenciesplan[0]->get_userid());
         $this->assertEquals($uclist[0]->get_competencyid(), $usercompetenciesplan[0]->get_competencyid());
@@ -1571,7 +1571,7 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // Change status of the plan to active.
         $record = $plan->to_record();
-        $record->status = \tool_lp\plan::STATUS_ACTIVE;
+        $record->status = \core_competency\plan::STATUS_ACTIVE;
 
         try {
             api::update_plan($record);
@@ -1582,8 +1582,8 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         api::reopen_plan($record->id);
         // Check that user_competency_plan objects are deleted if the plan status is changed to another status.
-        $this->assertEquals(2, \tool_lp\user_competency::count_records());
-        $this->assertEquals(0, \tool_lp\user_competency_plan::count_records());
+        $this->assertEquals(2, \core_competency\user_competency::count_records());
+        $this->assertEquals(0, \core_competency\user_competency_plan::count_records());
     }
 
     /**
@@ -1704,7 +1704,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c3 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
 
         // Create completed plan with records in user_competency.
-        $completedplan = $lpg->create_plan(array('userid' => $user->id, 'status' => \tool_lp\plan::STATUS_COMPLETE));
+        $completedplan = $lpg->create_plan(array('userid' => $user->id, 'status' => \core_competency\plan::STATUS_COMPLETE));
 
         $lpg->create_plan_competency(array('planid' => $completedplan->get_id(), 'competencyid' => $c1->get_id()));
         $lpg->create_plan_competency(array('planid' => $completedplan->get_id(), 'competencyid' => $c2->get_id()));
@@ -1720,9 +1720,9 @@ class tool_lp_api_testcase extends advanced_testcase {
         api::delete_plan($completedplan->get_id());
 
         // Check that achived user competencies are deleted.
-        $this->assertEquals(0, \tool_lp\plan::count_records());
-        $this->assertEquals(2, \tool_lp\user_competency::count_records());
-        $this->assertEquals(0, \tool_lp\user_competency_plan::count_records());
+        $this->assertEquals(0, \core_competency\plan::count_records());
+        $this->assertEquals(2, \core_competency\user_competency::count_records());
+        $this->assertEquals(0, \core_competency\user_competency_plan::count_records());
     }
 
     /**
@@ -1766,20 +1766,20 @@ class tool_lp_api_testcase extends advanced_testcase {
         $plancompetencies = api::list_plan_competencies($draftplan);
 
         $this->assertCount(3, $plancompetencies);
-        $this->assertInstanceOf('\tool_lp\user_competency', $plancompetencies[0]->usercompetency);
+        $this->assertInstanceOf('\core_competency\user_competency', $plancompetencies[0]->usercompetency);
         $this->assertEquals($uc1->get_id(), $plancompetencies[0]->usercompetency->get_id());
         $this->assertNull($plancompetencies[0]->usercompetencyplan);
 
-        $this->assertInstanceOf('\tool_lp\user_competency', $plancompetencies[1]->usercompetency);
+        $this->assertInstanceOf('\core_competency\user_competency', $plancompetencies[1]->usercompetency);
         $this->assertEquals($uc2->get_id(), $plancompetencies[1]->usercompetency->get_id());
         $this->assertNull($plancompetencies[1]->usercompetencyplan);
 
-        $this->assertInstanceOf('\tool_lp\user_competency', $plancompetencies[2]->usercompetency);
+        $this->assertInstanceOf('\core_competency\user_competency', $plancompetencies[2]->usercompetency);
         $this->assertEquals(0, $plancompetencies[2]->usercompetency->get_id());
         $this->assertNull($plancompetencies[2]->usercompetencyplan);
 
         // Create completed plan with records in user_competency_plan.
-        $completedplan = $lpg->create_plan(array('userid' => $user->id, 'status' => \tool_lp\plan::STATUS_COMPLETE));
+        $completedplan = $lpg->create_plan(array('userid' => $user->id, 'status' => \core_competency\plan::STATUS_COMPLETE));
 
         $pc1 = $lpg->create_plan_competency(array('planid' => $completedplan->get_id(), 'competencyid' => $c1->get_id()));
         $pc2 = $lpg->create_plan_competency(array('planid' => $completedplan->get_id(), 'competencyid' => $c2->get_id()));
@@ -1796,13 +1796,13 @@ class tool_lp_api_testcase extends advanced_testcase {
         $plancompetencies = api::list_plan_competencies($completedplan);
 
         $this->assertCount(3, $plancompetencies);
-        $this->assertInstanceOf('\tool_lp\user_competency_plan', $plancompetencies[0]->usercompetencyplan);
+        $this->assertInstanceOf('\core_competency\user_competency_plan', $plancompetencies[0]->usercompetencyplan);
         $this->assertEquals($ucp1->get_id(), $plancompetencies[0]->usercompetencyplan->get_id());
         $this->assertNull($plancompetencies[0]->usercompetency);
-        $this->assertInstanceOf('\tool_lp\user_competency_plan', $plancompetencies[1]->usercompetencyplan);
+        $this->assertInstanceOf('\core_competency\user_competency_plan', $plancompetencies[1]->usercompetencyplan);
         $this->assertEquals($ucp2->get_id(), $plancompetencies[1]->usercompetencyplan->get_id());
         $this->assertNull($plancompetencies[1]->usercompetency);
-        $this->assertInstanceOf('\tool_lp\user_competency_plan', $plancompetencies[2]->usercompetencyplan);
+        $this->assertInstanceOf('\core_competency\user_competency_plan', $plancompetencies[2]->usercompetencyplan);
         $this->assertEquals($ucp3->get_id(), $plancompetencies[2]->usercompetencyplan->get_id());
         $this->assertNull($plancompetencies[2]->usercompetency);
     }
@@ -1819,18 +1819,18 @@ class tool_lp_api_testcase extends advanced_testcase {
         $t1 = $lpg->create_template();
         $t2 = $lpg->create_template();
 
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records());
+        $this->assertEquals(0, \core_competency\template_cohort::count_records());
 
         // Create two relations with mixed parameters.
         $result = api::create_template_cohort($t1->get_id(), $c1->id);
         $result = api::create_template_cohort($t1, $c2);
 
-        $this->assertEquals(2, \tool_lp\template_cohort::count_records());
-        $this->assertInstanceOf('tool_lp\template_cohort', $result);
+        $this->assertEquals(2, \core_competency\template_cohort::count_records());
+        $this->assertInstanceOf('core_competency\template_cohort', $result);
         $this->assertEquals($c2->id, $result->get_cohortid());
         $this->assertEquals($t1->get_id(), $result->get_templateid());
-        $this->assertEquals(2, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
+        $this->assertEquals(2, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
+        $this->assertEquals(0, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
     }
 
     public function test_create_template_cohort_permissions() {
@@ -1856,11 +1856,11 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c2 = $dg->create_cohort(array('visible' => 0, 'contextid' => $catcontext->id));
         $t1 = $lpg->create_template();
 
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records());
+        $this->assertEquals(0, \core_competency\template_cohort::count_records());
 
         $this->setUser($user);
         $result = api::create_template_cohort($t1, $c1);
-        $this->assertInstanceOf('tool_lp\\template_cohort', $result);
+        $this->assertInstanceOf('core_competency\\template_cohort', $result);
 
         try {
             $result = api::create_template_cohort($t1, $c2);
@@ -1874,7 +1874,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         accesslib_clear_all_caches_for_unit_testing();
 
         $result = api::create_template_cohort($t1, $c2);
-        $this->assertInstanceOf('tool_lp\\template_cohort', $result);
+        $this->assertInstanceOf('core_competency\\template_cohort', $result);
     }
 
     public function test_delete_template() {
@@ -1894,17 +1894,17 @@ class tool_lp_api_testcase extends advanced_testcase {
         $tc1 = $lpg->create_template_cohort(array('templateid' => $template->get_id(), 'cohortid' => $c2->id));
 
         // Check pre-test.
-        $this->assertTrue(tool_lp\template::record_exists($id));
-        $this->assertEquals(2, \tool_lp\template_cohort::count_records(array('templateid' => $id)));
+        $this->assertTrue(\core_competency\template::record_exists($id));
+        $this->assertEquals(2, \core_competency\template_cohort::count_records(array('templateid' => $id)));
 
         $result = api::delete_template($template->get_id());
         $this->assertTrue($result);
 
         // Check that the template deos not exist anymore.
-        $this->assertFalse(tool_lp\template::record_exists($id));
+        $this->assertFalse(\core_competency\template::record_exists($id));
 
         // Test if associated cohorts are also deleted.
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records(array('templateid' => $id)));
+        $this->assertEquals(0, \core_competency\template_cohort::count_records(array('templateid' => $id)));
     }
 
     public function test_delete_template_cohort() {
@@ -1921,23 +1921,23 @@ class tool_lp_api_testcase extends advanced_testcase {
         $tc1 = $lpg->create_template_cohort(array('templateid' => $t1->get_id(), 'cohortid' => $c1->id));
         $tc1 = $lpg->create_template_cohort(array('templateid' => $t2->get_id(), 'cohortid' => $c2->id));
 
-        $this->assertEquals(2, \tool_lp\template_cohort::count_records());
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
+        $this->assertEquals(2, \core_competency\template_cohort::count_records());
+        $this->assertEquals(1, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
+        $this->assertEquals(1, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
 
         // Delete existing.
         $result = api::delete_template_cohort($t1->get_id(), $c1->id);
         $this->assertTrue($result);
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records());
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
+        $this->assertEquals(1, \core_competency\template_cohort::count_records());
+        $this->assertEquals(0, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
+        $this->assertEquals(1, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
 
         // Delete non-existant.
         $result = api::delete_template_cohort($t1->get_id(), $c1->id);
         $this->assertTrue($result);
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records());
-        $this->assertEquals(0, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
-        $this->assertEquals(1, \tool_lp\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
+        $this->assertEquals(1, \core_competency\template_cohort::count_records());
+        $this->assertEquals(0, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t1->get_id())));
+        $this->assertEquals(1, \core_competency\template_cohort::count_records_select('templateid = :id', array('id' => $t2->get_id())));
     }
 
     public function test_add_evidence_log() {
@@ -1952,15 +1952,15 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c2 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         // Creating a standard evidence with minimal information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata', 'error');
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata', 'error');
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertSame(null, $uc->get_grade());
         $this->assertSame(null, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_LOG, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_LOG, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -1969,16 +1969,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating a standard evidence with more information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata', 'error',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata', 'error',
             '$a', false, 'http://moodle.org', null, 2, 'The evidence of prior learning were reviewed.');
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertSame(null, $uc->get_grade());
         $this->assertSame(null, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_LOG, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_LOG, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertEquals('$a', $evidence->get_desca());
@@ -1988,15 +1988,15 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame('The evidence of prior learning were reviewed.', $evidence->get_note());
 
         // Creating a standard evidence and send for review.
-        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata',
             'error', null, true);
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
 
         // Trying to pass a grade should fail.
         try {
-            $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata',
+            $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata',
                 'error', null, false, null, 1);
             $this->fail('A grade can not be set');
         } catch (coding_exception $e) {
@@ -2027,16 +2027,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c3 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         // Creating an evidence with minimal information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_COMPLETE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_COMPLETE, 'invaliddata',
             'error');
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertEquals(2, $uc->get_grade());    // The grade has been set automatically to the framework default.
         $this->assertEquals(0, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_COMPLETE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_COMPLETE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2045,16 +2045,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating an evidence complete on competency with custom scale.
-        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_COMPLETE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_COMPLETE, 'invaliddata',
             'error');
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertEquals(4, $uc->get_grade());    // The grade has been set automatically to the competency default.
         $this->assertEquals(true, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_COMPLETE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_COMPLETE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2067,16 +2067,16 @@ class tool_lp_api_testcase extends advanced_testcase {
             'proficiency' => 0));
         $this->assertEquals(1, $uc->get_grade());
         $this->assertEquals(0, $uc->get_proficiency());
-        $evidence = api::add_evidence($u1->id, $c3->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_COMPLETE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c3->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_COMPLETE, 'invaliddata',
             'error');
         $evidence->read();
         $uc->read();
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertEquals(1, $uc->get_grade());    // The grade has not been changed.
         $this->assertEquals(0, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_COMPLETE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_COMPLETE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2085,15 +2085,15 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating a standard evidence and send for review.
-        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_COMPLETE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_COMPLETE, 'invaliddata',
             'error', null, true);
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
 
         // Trying to pass a grade should throw an exception.
         try {
-            api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_COMPLETE, 'invaliddata',
+            api::add_evidence($u1->id, $c2->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_COMPLETE, 'invaliddata',
                 'error', null, false, null, 1);
         } catch (coding_exception $e) {
             $this->assertRegExp('/grade MUST NOT be set/', $e->getMessage());
@@ -2111,16 +2111,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c1 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         // Creating an evidence with minimal information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_OVERRIDE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_OVERRIDE, 'invaliddata',
             'error');
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertSame(null, $uc->get_grade());      // We overrode with 'null'.
         $this->assertSame(null, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_OVERRIDE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_OVERRIDE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2129,16 +2129,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating an evidence with a grade information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_OVERRIDE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_OVERRIDE, 'invaliddata',
             'error', null, false, null, 3);
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertEquals(3, $uc->get_grade());
         $this->assertEquals(true, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_OVERRIDE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_OVERRIDE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2147,16 +2147,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating an evidence with another grade information.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_OVERRIDE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_OVERRIDE, 'invaliddata',
             'error', null, false, null, 1);
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc->get_status());
         $this->assertEquals(1, $uc->get_grade());
         $this->assertEquals(0, $uc->get_proficiency());
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals($u1ctx->id, $evidence->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_OVERRIDE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_OVERRIDE, $evidence->get_action());
         $this->assertEquals('invaliddata', $evidence->get_descidentifier());
         $this->assertEquals('error', $evidence->get_desccomponent());
         $this->assertSame(null, $evidence->get_desca());
@@ -2165,13 +2165,13 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $evidence->get_actionuserid());
 
         // Creating reverting the grade and send for review.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_OVERRIDE, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_OVERRIDE, 'invaliddata',
             'error', null, true);
         $evidence->read();
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
         $this->assertSame(null, $uc->get_grade());
         $this->assertSame(null, $uc->get_proficiency());
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
         $this->assertSame(null, $evidence->get_grade());
     }
 
@@ -2186,24 +2186,24 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c1 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         // Non-existing user competencies are created up for review.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata',
             'error', null, true);
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
+        $uc = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c1->get_id()));
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
 
         // Existing user competencies sent for review don't change.
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata',
             'error', null, true);
         $uc->read();
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc->get_status());
 
         // A user competency with a status non-idle won't change.
-        $uc->set_status(\tool_lp\user_competency::STATUS_IN_REVIEW);
+        $uc->set_status(\core_competency\user_competency::STATUS_IN_REVIEW);
         $uc->update();
-        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \tool_lp\evidence::ACTION_LOG, 'invaliddata',
+        $evidence = api::add_evidence($u1->id, $c1->get_id(), $u1ctx->id, \core_competency\evidence::ACTION_LOG, 'invaliddata',
             'error', null, true);
         $uc->read();
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IN_REVIEW, $uc->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_IN_REVIEW, $uc->get_status());
     }
 
     /**
@@ -2230,9 +2230,9 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertSame(null, $uc->get_proficiency());
 
         // Create an evidence and check it was created with the right usercomptencyid and information.
-        $evidence = api::add_evidence($user->id, $c1->get_id(), $syscontext->id, \tool_lp\evidence::ACTION_OVERRIDE,
+        $evidence = api::add_evidence($user->id, $c1->get_id(), $syscontext->id, \core_competency\evidence::ACTION_OVERRIDE,
             'invalidevidencedesc', 'tool_lp', array('a' => 'b'), false, 'http://moodle.org', 1, 2);
-        $this->assertEquals(1, \tool_lp\evidence::count_records());
+        $this->assertEquals(1, \core_competency\evidence::count_records());
 
         $evidence->read();
         $uc->read();
@@ -2241,7 +2241,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertEquals('tool_lp', $evidence->get_desccomponent());
         $this->assertEquals((object) array('a' => 'b'), $evidence->get_desca());
         $this->assertEquals('http://moodle.org', $evidence->get_url());
-        $this->assertEquals(\tool_lp\evidence::ACTION_OVERRIDE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_OVERRIDE, $evidence->get_action());
         $this->assertEquals(2, $evidence->get_actionuserid());
         $this->assertEquals(1, $evidence->get_grade());
         $this->assertEquals(1, $uc->get_grade());
@@ -2266,22 +2266,22 @@ class tool_lp_api_testcase extends advanced_testcase {
         $framework = $lpg->create_framework();
         $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
         $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
-        $this->assertEquals(0, \tool_lp\user_competency::count_records());
+        $this->assertEquals(0, \core_competency\user_competency::count_records());
 
         // Create an evidence without a user competency record.
-        $evidence = api::add_evidence($user->id, $c1->get_id(), $syscontext->id, \tool_lp\evidence::ACTION_OVERRIDE,
+        $evidence = api::add_evidence($user->id, $c1->get_id(), $syscontext->id, \core_competency\evidence::ACTION_OVERRIDE,
             'invalidevidencedesc', 'tool_lp', 'Hello world!', false, 'http://moodle.org', 1, 2);
-        $this->assertEquals(1, \tool_lp\evidence::count_records());
-        $this->assertEquals(1, \tool_lp\user_competency::count_records());
+        $this->assertEquals(1, \core_competency\evidence::count_records());
+        $this->assertEquals(1, \core_competency\user_competency::count_records());
 
-        $uc = \tool_lp\user_competency::get_record(array('userid' => $user->id, 'competencyid' => $c1->get_id()));
+        $uc = \core_competency\user_competency::get_record(array('userid' => $user->id, 'competencyid' => $c1->get_id()));
         $evidence->read();
         $this->assertEquals($uc->get_id(), $evidence->get_usercompetencyid());
         $this->assertEquals('invalidevidencedesc', $evidence->get_descidentifier());
         $this->assertEquals('tool_lp', $evidence->get_desccomponent());
         $this->assertEquals('Hello world!', $evidence->get_desca());
         $this->assertEquals('http://moodle.org', $evidence->get_url());
-        $this->assertEquals(\tool_lp\evidence::ACTION_OVERRIDE, $evidence->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_OVERRIDE, $evidence->get_action());
         $this->assertEquals(2, $evidence->get_actionuserid());
         $this->assertEquals(1, $evidence->get_grade());
         $this->assertEquals(1, $uc->get_grade());
@@ -2311,17 +2311,17 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c5 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         // Setting up the rules.
-        $c1->set_ruletype('tool_lp\\competency_rule_all');
-        $c1->set_ruleoutcome(\tool_lp\competency::OUTCOME_COMPLETE);
+        $c1->set_ruletype('core_competency\\competency_rule_all');
+        $c1->set_ruleoutcome(\core_competency\competency::OUTCOME_COMPLETE);
         $c1->update();
-        $c2->set_ruletype('tool_lp\\competency_rule_all');
-        $c2->set_ruleoutcome(\tool_lp\competency::OUTCOME_RECOMMEND);
+        $c2->set_ruletype('core_competency\\competency_rule_all');
+        $c2->set_ruleoutcome(\core_competency\competency::OUTCOME_RECOMMEND);
         $c2->update();
-        $c3->set_ruletype('tool_lp\\competency_rule_all');
-        $c3->set_ruleoutcome(\tool_lp\competency::OUTCOME_EVIDENCE);
+        $c3->set_ruletype('core_competency\\competency_rule_all');
+        $c3->set_ruleoutcome(\core_competency\competency::OUTCOME_EVIDENCE);
         $c3->update();
-        $c4->set_ruletype('tool_lp\\competency_rule_all');
-        $c4->set_ruleoutcome(\tool_lp\competency::OUTCOME_NONE);
+        $c4->set_ruletype('core_competency\\competency_rule_all');
+        $c4->set_ruleoutcome(\core_competency\competency::OUTCOME_NONE);
         $c4->update();
 
         // Confirm the current data.
@@ -2408,7 +2408,7 @@ class tool_lp_api_testcase extends advanced_testcase {
             'userid' => $student->id,
             'competencyid' => $comp->get_id(),
         );
-        $usercompcourse = \tool_lp\user_competency_course::get_record($filterparams);
+        $usercompcourse = \core_competency\user_competency_course::get_record($filterparams);
         // There should be no user_competency_course object created when grading.
         $this->assertFalse($usercompcourse);
     }
@@ -2455,7 +2455,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $evidence = api::add_evidence($student->id, $comp, $coursecontext, evidence::ACTION_OVERRIDE,
             'commentincontext', 'core', null, false, null, 3, $USER->id);
         // Get user competency course record.
-        $usercompcourse = \tool_lp\user_competency_course::get_record($filterparams);
+        $usercompcourse = \core_competency\user_competency_course::get_record($filterparams);
         // There should be a user_competency_course object when adding a grade.
         $this->assertNotEmpty($usercompcourse);
         $grade = $evidence->get_grade();
@@ -2469,7 +2469,7 @@ class tool_lp_api_testcase extends advanced_testcase {
             'userid' => $student->id,
             'competencyid' => $comp->get_id(),
         ];
-        $usercompetency = \tool_lp\user_competency::get_record($usercompetencyparams);
+        $usercompetency = \core_competency\user_competency::get_record($usercompetencyparams);
         $this->assertNotEmpty($usercompetency);
         $this->assertNotEquals($usercompcourse->get_grade(), $usercompetency->get_grade());
         $this->assertNotEquals($usercompcourse->get_proficiency(), $usercompetency->get_proficiency());
@@ -2490,13 +2490,13 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c3 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
         $c4 = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
         $cc1 = $lpg->create_course_competency(array('competencyid' => $c1->get_id(), 'courseid' => $course->id,
-            'ruleoutcome' => \tool_lp\course_competency::OUTCOME_NONE));
+            'ruleoutcome' => \core_competency\course_competency::OUTCOME_NONE));
         $cc2 = $lpg->create_course_competency(array('competencyid' => $c2->get_id(), 'courseid' => $course->id,
-            'ruleoutcome' => \tool_lp\course_competency::OUTCOME_EVIDENCE));
+            'ruleoutcome' => \core_competency\course_competency::OUTCOME_EVIDENCE));
         $cc3 = $lpg->create_course_competency(array('competencyid' => $c3->get_id(), 'courseid' => $course->id,
-            'ruleoutcome' => \tool_lp\course_competency::OUTCOME_RECOMMEND));
+            'ruleoutcome' => \core_competency\course_competency::OUTCOME_RECOMMEND));
         $cc4 = $lpg->create_course_competency(array('competencyid' => $c4->get_id(), 'courseid' => $course->id,
-            'ruleoutcome' => \tool_lp\course_competency::OUTCOME_COMPLETE));
+            'ruleoutcome' => \core_competency\course_competency::OUTCOME_COMPLETE));
 
         $event = \core\event\course_completed::create(array(
             'objectid' => 1,
@@ -2505,26 +2505,26 @@ class tool_lp_api_testcase extends advanced_testcase {
             'courseid' => $course->id,
             'other' => array('relateduserid' => $u1->id)
         ));
-        $this->assertEquals(0, \tool_lp\user_competency::count_records());
-        $this->assertEquals(0, \tool_lp\evidence::count_records());
+        $this->assertEquals(0, \core_competency\user_competency::count_records());
+        $this->assertEquals(0, \core_competency\evidence::count_records());
 
         // Let's go!
         api::observe_course_completed($event);
-        $this->assertEquals(3, \tool_lp\user_competency::count_records());
-        $this->assertEquals(3, \tool_lp\evidence::count_records());
+        $this->assertEquals(3, \core_competency\user_competency::count_records());
+        $this->assertEquals(3, \core_competency\evidence::count_records());
 
         // Outcome NONE did nothing.
-        $this->assertFalse(\tool_lp\user_competency::record_exists_select('userid = :uid AND competencyid = :cid', array(
+        $this->assertFalse(\core_competency\user_competency::record_exists_select('userid = :uid AND competencyid = :cid', array(
             'uid' => $u1->id, 'cid' => $c1->get_id()
         )));
 
         // Outcome evidence.
-        $uc2 = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
-        $ev2 = \tool_lp\evidence::get_record(array('usercompetencyid' => $uc2->get_id()));
+        $uc2 = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c2->get_id()));
+        $ev2 = \core_competency\evidence::get_record(array('usercompetencyid' => $uc2->get_id()));
 
         $this->assertEquals(null, $uc2->get_grade());
         $this->assertEquals(null, $uc2->get_proficiency());
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc2->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc2->get_status());
 
         $this->assertEquals('evidence_coursecompleted', $ev2->get_descidentifier());
         $this->assertEquals('tool_lp', $ev2->get_desccomponent());
@@ -2532,16 +2532,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertStringEndsWith('/report/completion/index.php?course=' . $course->id, $ev2->get_url());
         $this->assertEquals(null, $ev2->get_grade());
         $this->assertEquals($coursectx->id, $ev2->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_LOG, $ev2->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_LOG, $ev2->get_action());
         $this->assertEquals(null, $ev2->get_actionuserid());
 
         // Outcome recommend.
-        $uc3 = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c3->get_id()));
-        $ev3 = \tool_lp\evidence::get_record(array('usercompetencyid' => $uc3->get_id()));
+        $uc3 = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c3->get_id()));
+        $ev3 = \core_competency\evidence::get_record(array('usercompetencyid' => $uc3->get_id()));
 
         $this->assertEquals(null, $uc3->get_grade());
         $this->assertEquals(null, $uc3->get_proficiency());
-        $this->assertEquals(\tool_lp\user_competency::STATUS_WAITING_FOR_REVIEW, $uc3->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_WAITING_FOR_REVIEW, $uc3->get_status());
 
         $this->assertEquals('evidence_coursecompleted', $ev3->get_descidentifier());
         $this->assertEquals('tool_lp', $ev3->get_desccomponent());
@@ -2549,16 +2549,16 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertStringEndsWith('/report/completion/index.php?course=' . $course->id, $ev3->get_url());
         $this->assertEquals(null, $ev3->get_grade());
         $this->assertEquals($coursectx->id, $ev3->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_LOG, $ev3->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_LOG, $ev3->get_action());
         $this->assertEquals(null, $ev3->get_actionuserid());
 
         // Outcome complete.
-        $uc4 = \tool_lp\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c4->get_id()));
-        $ev4 = \tool_lp\evidence::get_record(array('usercompetencyid' => $uc4->get_id()));
+        $uc4 = \core_competency\user_competency::get_record(array('userid' => $u1->id, 'competencyid' => $c4->get_id()));
+        $ev4 = \core_competency\evidence::get_record(array('usercompetencyid' => $uc4->get_id()));
 
         $this->assertEquals(3, $uc4->get_grade());
         $this->assertEquals(1, $uc4->get_proficiency());
-        $this->assertEquals(\tool_lp\user_competency::STATUS_IDLE, $uc4->get_status());
+        $this->assertEquals(\core_competency\user_competency::STATUS_IDLE, $uc4->get_status());
 
         $this->assertEquals('evidence_coursecompleted', $ev4->get_descidentifier());
         $this->assertEquals('tool_lp', $ev4->get_desccomponent());
@@ -2566,7 +2566,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertStringEndsWith('/report/completion/index.php?course=' . $course->id, $ev4->get_url());
         $this->assertEquals(3, $ev4->get_grade());
         $this->assertEquals($coursectx->id, $ev4->get_contextid());
-        $this->assertEquals(\tool_lp\evidence::ACTION_COMPLETE, $ev4->get_action());
+        $this->assertEquals(\core_competency\evidence::ACTION_COMPLETE, $ev4->get_action());
         $this->assertEquals(null, $ev4->get_actionuserid());
     }
 
@@ -2653,15 +2653,15 @@ class tool_lp_api_testcase extends advanced_testcase {
         $cc = api::add_competency_to_course($course->id, $c->get_id());
 
         // Check record was created with default rule value Evidence.
-        $this->assertEquals(1, \tool_lp\course_competency::count_records());
+        $this->assertEquals(1, \core_competency\course_competency::count_records());
         $recordscc = api::list_course_competencies($course->id);
-        $this->assertEquals(\tool_lp\course_competency::OUTCOME_EVIDENCE, $recordscc[0]['coursecompetency']->get_ruleoutcome());
+        $this->assertEquals(\core_competency\course_competency::OUTCOME_EVIDENCE, $recordscc[0]['coursecompetency']->get_ruleoutcome());
 
         // Check ruleoutcome value is updated to None.
         $this->assertTrue(api::set_course_competency_ruleoutcome($recordscc[0]['coursecompetency']->get_id(),
-            \tool_lp\course_competency::OUTCOME_NONE));
+            \core_competency\course_competency::OUTCOME_NONE));
         $recordscc = api::list_course_competencies($course->id);
-        $this->assertEquals(\tool_lp\course_competency::OUTCOME_NONE, $recordscc[0]['coursecompetency']->get_ruleoutcome());
+        $this->assertEquals(\core_competency\course_competency::OUTCOME_NONE, $recordscc[0]['coursecompetency']->get_ruleoutcome());
     }
 
     /**
@@ -2704,7 +2704,7 @@ class tool_lp_api_testcase extends advanced_testcase {
                 'proficiency' => true, 'grade' => 3 ));
             $usercompetency->create();
             $this->fail('Invalid grade not detected in framework scale');
-        } catch (\tool_lp\invalid_persistent_exception $e) {
+        } catch (\core_competency\invalid_persistent_exception $e) {
             $this->assertTrue(true);
         }
 
@@ -2714,7 +2714,7 @@ class tool_lp_api_testcase extends advanced_testcase {
                 'proficiency' => true, 'grade' => 5 ));
             $usercompetency->create();
             $this->fail('Invalid grade not detected in competency scale');
-        } catch (\tool_lp\invalid_persistent_exception $e) {
+        } catch (\core_competency\invalid_persistent_exception $e) {
             $this->assertTrue(true);
         }
 
@@ -2724,7 +2724,7 @@ class tool_lp_api_testcase extends advanced_testcase {
                 'proficiency' => true, 'grade' => 1 ));
             $usercompetency->create();
             $this->assertTrue(true);
-        } catch (\tool_lp\invalid_persistent_exception $e) {
+        } catch (\core_competency\invalid_persistent_exception $e) {
             $this->fail('Valide grade rejected in framework scale');
         }
 
@@ -2734,7 +2734,7 @@ class tool_lp_api_testcase extends advanced_testcase {
                 'proficiency' => true, 'grade' => 4 ));
             $usercompetency->create();
             $this->assertTrue(true);
-        } catch (\tool_lp\invalid_persistent_exception $e) {
+        } catch (\core_competency\invalid_persistent_exception $e) {
             $this->fail('Valide grade rejected in competency scale');
         }
     }
@@ -2814,7 +2814,7 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // Can associate hidden template to cohort.
         $templatecohort = api::create_template_cohort($template->get_id(), $cohort->id);
-        $this->assertInstanceOf('\tool_lp\template_cohort', $templatecohort);
+        $this->assertInstanceOf('\core_competency\template_cohort', $templatecohort);
     }
 
     /**
@@ -2847,8 +2847,8 @@ class tool_lp_api_testcase extends advanced_testcase {
         api::complete_plan($plan);
 
         // Check user competency plan created correctly.
-        $this->assertEquals(3, \tool_lp\user_competency_plan::count_records());
-        $ucp = \tool_lp\user_competency_plan::get_records();
+        $this->assertEquals(3, \core_competency\user_competency_plan::count_records());
+        $ucp = \core_competency\user_competency_plan::get_records();
         $this->assertEquals($ucp[0]->get_competencyid(), $c1->get_id());
         $this->assertEquals($ucp[1]->get_competencyid(), $c2->get_id());
         $this->assertEquals($ucp[2]->get_competencyid(), $c3->get_id());
@@ -2886,19 +2886,19 @@ class tool_lp_api_testcase extends advanced_testcase {
         $c2a = $lpg->create_competency(array('competencyframeworkid' => $f1->get_id()));
 
         $c1->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c1->set_ruletype('tool_lp\\competency_rule_all');
+        $c1->set_ruletype('core_competency\\competency_rule_all');
         $c1->update();
         $c1a->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c1a->set_ruletype('tool_lp\\competency_rule_all');
+        $c1a->set_ruletype('core_competency\\competency_rule_all');
         $c1a->update();
         $c1a1->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c1a1->set_ruletype('tool_lp\\competency_rule_all');
+        $c1a1->set_ruletype('core_competency\\competency_rule_all');
         $c1a1->update();
         $c1b->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c1b->set_ruletype('tool_lp\\competency_rule_all');
+        $c1b->set_ruletype('core_competency\\competency_rule_all');
         $c1b->update();
         $c2->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c2->set_ruletype('tool_lp\\competency_rule_all');
+        $c2->set_ruletype('core_competency\\competency_rule_all');
         $c2->update();
 
         return array(
@@ -3146,21 +3146,21 @@ class tool_lp_api_testcase extends advanced_testcase {
         $p1 = $lpg->create_plan(array('templateid' => $tpl->get_id(), 'userid' => $u1->id));
 
         // Check pre-test.
-        $this->assertTrue(tool_lp\template::record_exists($tpl->get_id()));
-        $this->assertEquals(2, \tool_lp\template_competency::count_competencies($tpl->get_id()));
-        $this->assertEquals(1, count(\tool_lp\plan::get_records(array('templateid' => $tpl->get_id()))));
+        $this->assertTrue(\core_competency\template::record_exists($tpl->get_id()));
+        $this->assertEquals(2, \core_competency\template_competency::count_competencies($tpl->get_id()));
+        $this->assertEquals(1, count(\core_competency\plan::get_records(array('templateid' => $tpl->get_id()))));
 
         $result = api::delete_template($tpl->get_id(), true);
         $this->assertTrue($result);
 
         // Check that the template does not exist anymore.
-        $this->assertFalse(tool_lp\template::record_exists($tpl->get_id()));
+        $this->assertFalse(\core_competency\template::record_exists($tpl->get_id()));
 
         // Check that associated competencies are also deleted.
-        $this->assertEquals(0, \tool_lp\template_competency::count_competencies($tpl->get_id()));
+        $this->assertEquals(0, \core_competency\template_competency::count_competencies($tpl->get_id()));
 
         // Check that associated plan are also deleted.
-        $this->assertEquals(0, count(\tool_lp\plan::get_records(array('templateid' => $tpl->get_id()))));
+        $this->assertEquals(0, count(\core_competency\plan::get_records(array('templateid' => $tpl->get_id()))));
     }
 
     public function test_delete_template_unlink_plans() {
@@ -3185,21 +3185,21 @@ class tool_lp_api_testcase extends advanced_testcase {
         $p1 = $lpg->create_plan(array('templateid' => $tpl->get_id(), 'userid' => $u1->id));
 
         // Check pre-test.
-        $this->assertTrue(tool_lp\template::record_exists($tpl->get_id()));
-        $this->assertEquals(2, \tool_lp\template_competency::count_competencies($tpl->get_id()));
-        $this->assertEquals(1, count(\tool_lp\plan::get_records(array('templateid' => $tpl->get_id()))));
+        $this->assertTrue(\core_competency\template::record_exists($tpl->get_id()));
+        $this->assertEquals(2, \core_competency\template_competency::count_competencies($tpl->get_id()));
+        $this->assertEquals(1, count(\core_competency\plan::get_records(array('templateid' => $tpl->get_id()))));
 
         $result = api::delete_template($tpl->get_id(), false);
         $this->assertTrue($result);
 
         // Check that the template does not exist anymore.
-        $this->assertFalse(tool_lp\template::record_exists($tpl->get_id()));
+        $this->assertFalse(\core_competency\template::record_exists($tpl->get_id()));
 
         // Check that associated competencies are also deleted.
-        $this->assertEquals(0, \tool_lp\template_competency::count_competencies($tpl->get_id()));
+        $this->assertEquals(0, \core_competency\template_competency::count_competencies($tpl->get_id()));
 
         // Check that associated plan still exist but unlink from template.
-        $plans = \tool_lp\plan::get_records(array('id' => $p1->get_id()));
+        $plans = \core_competency\plan::get_records(array('id' => $p1->get_id()));
         $this->assertEquals(1, count($plans));
         $this->assertEquals($plans[0]->get_origtemplateid(), $tpl->get_id());
         $this->assertNull($plans[0]->get_templateid());
@@ -3223,7 +3223,7 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         // Set rules on parent competency.
         $c1->set_ruleoutcome(competency::OUTCOME_EVIDENCE);
-        $c1->set_ruletype('tool_lp\\competency_rule_all');
+        $c1->set_ruletype('core_competency\\competency_rule_all');
         $c1->update();
 
         // If we delete competeny, the related competencies relations and evidences should be deleted.
@@ -3255,7 +3255,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c12b->get_id()));
 
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
         $this->assertEquals(0, count(api::list_related_competencies($c2->get_id())));
@@ -3482,10 +3482,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c12b->get_id()));
 
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
 
         // Delete a simple framework.
         $f2 = $lpg->create_framework();
@@ -3545,10 +3545,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c11b->get_id()));
         $this->assertFalse(competency::record_exists($c12b->get_id()));
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
     }
 
     public function test_delete_framework_competency_used_in_usercompetency() {
@@ -3602,10 +3602,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c11b->get_id()));
         $this->assertFalse(competency::record_exists($c12b->get_id()));
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
     }
 
     public function test_delete_framework_competency_used_in_usercompetencyplan() {
@@ -3665,10 +3665,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c11b->get_id()));
         $this->assertFalse(competency::record_exists($c12b->get_id()));
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
     }
 
     public function test_delete_framework_competency_used_in_template() {
@@ -3725,10 +3725,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c11b->get_id()));
         $this->assertFalse(competency::record_exists($c12b->get_id()));
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
     }
 
     public function test_delete_framework_competency_used_in_course() {
@@ -3787,10 +3787,10 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertFalse(competency::record_exists($c11b->get_id()));
         $this->assertFalse(competency::record_exists($c12b->get_id()));
         // Check if evidence are also deleted.
-        $this->assertEquals(0, tool_lp\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
+        $this->assertEquals(0, \core_competency\user_evidence_competency::count_records(array('competencyid' => $c11b->get_id())));
 
         // Check if related conpetency relation is deleted.
-        $this->assertEquals(0, count(\tool_lp\related_competency::get_multiple_relations(array($c2id))));
+        $this->assertEquals(0, count(\core_competency\related_competency::get_multiple_relations(array($c2id))));
     }
 
     public function test_grade_competency_in_course_permissions() {
@@ -4248,14 +4248,14 @@ class tool_lp_api_testcase extends advanced_testcase {
 
         $this->assertEquals(4, count($result));
         foreach ($result as $one) {
-            $this->assertInstanceOf('\tool_lp\plan', $one);
+            $this->assertInstanceOf('\core_competency\plan', $one);
         }
         // This lists the plans based on this template, optionally filtered by status.
         $result = api::list_plans_for_template($tpl->get_id(), plan::STATUS_COMPLETE);
 
         $this->assertEquals(3, count($result));
         foreach ($result as $one) {
-            $this->assertInstanceOf('\tool_lp\plan', $one);
+            $this->assertInstanceOf('\core_competency\plan', $one);
             $this->assertEquals(plan::STATUS_COMPLETE, $one->get_status());
         }
 
@@ -4273,7 +4273,7 @@ class tool_lp_api_testcase extends advanced_testcase {
         $this->assertEquals(2, count($result));
         $leastarray = array($comp4->get_id(), $comp6->get_id());
         foreach ($result as $one) {
-            $this->assertInstanceOf('\tool_lp\competency', $one);
+            $this->assertInstanceOf('\core_competency\competency', $one);
             $this->assertContains($one->get_id(), $leastarray);
         }
     }
index e069454..29fbcdb 100644 (file)
@@ -27,8 +27,10 @@ require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
 
 use Behat\Gherkin\Node\TableNode as TableNode;
 use Behat\Behat\Exception\PendingException as PendingException;
-use tool_lp\competency_framework;
-use tool_lp\plan;
+use core_competency\competency;
+use core_competency\competency_framework;
+use core_competency\plan;
+use core_competency\user_evidence;
 
 /**
  * Step definition to generate database fixtures for learning plan system.
@@ -267,13 +269,13 @@ class behat_tool_lp_data_generators extends behat_base {
         global $DB;
 
         if (isset($data['plan'])) {
-            $plan = $DB->get_record('tool_lp_plan', array('name' => $data['plan']), '*', MUST_EXIST);
+            $plan = $DB->get_record(plan::TABLE, array('name' => $data['plan']), '*', MUST_EXIST);
             $data['planid'] = $plan->id;
         }
         unset($data['plan']);
 
         if (isset($data['competency'])) {
-            $competency = $DB->get_record('tool_lp_competency', array('shortname' => $data['competency']), '*', MUST_EXIST);
+            $competency = $DB->get_record(competency::TABLE, array('shortname' => $data['competency']), '*', MUST_EXIST);
             $data['competencyid'] = $competency->id;
         }
         unset($data['competency']);
@@ -290,13 +292,13 @@ class behat_tool_lp_data_generators extends behat_base {
         global $DB;
 
         if (isset($data['userevidence'])) {
-            $userevidence = $DB->get_record('tool_lp_user_evidence', array('name' => $data['userevidence']), '*', MUST_EXIST);
+            $userevidence = $DB->get_record(user_evidence::TABLE, array('name' => $data['userevidence']), '*', MUST_EXIST);
             $data['userevidenceid'] = $userevidence->id;
         }
         unset($data['userevidence']);
 
         if (isset($data['competency'])) {
-            $competency = $DB->get_record('tool_lp_competency', array('shortname' => $data['competency']), '*', MUST_EXIST);
+            $competency = $DB->get_record(competency::TABLE, array('shortname' => $data['competency']), '*', MUST_EXIST);
             $data['competencyid'] = $competency->id;
         }
         unset($data['competency']);
@@ -319,7 +321,7 @@ class behat_tool_lp_data_generators extends behat_base {
         unset($data['user']);
 
         if (isset($data['competency'])) {
-            $competency = $DB->get_record('tool_lp_competency', array('shortname' => $data['competency']), '*', MUST_EXIST);
+            $competency = $DB->get_record(competency::TABLE, array('shortname' => $data['competency']), '*', MUST_EXIST);
             $data['competencyid'] = $competency->id;
         }
         unset($data['competency']);
@@ -343,13 +345,13 @@ class behat_tool_lp_data_generators extends behat_base {
         unset($data['user']);
 
         if (isset($data['competency'])) {
-            $competency = $DB->get_record('tool_lp_competency', array('shortname' => $data['competency']), '*', MUST_EXIST);
+            $competency = $DB->get_record(competency::TABLE, array('shortname' => $data['competency']), '*', MUST_EXIST);
             $data['competencyid'] = $competency->id;
         }
         unset($data['competency']);
 
         if (isset($data['plan'])) {
-            $plan = $DB->get_record('tool_lp_plan', array('name' => $data['plan']), '*', MUST_EXIST);
+            $plan = $DB->get_record(plan::TABLE, array('name' => $data['plan']), '*', MUST_EXIST);
             $data['planid'] = $plan->id;
         }
         unset($data['plan']);
index 6c8a3c6..acbb121 100644 (file)
@@ -27,10 +27,10 @@ defined('MOODLE_INTERNAL') || die();
 global $CFG;
 require_once($CFG->dirroot . '/webservice/tests/helpers.php');
 
-use tool_lp\user_competency;
-use tool_lp\competency;
-use tool_lp\competency_rule_all;
-use tool_lp\competency_rule_points;
+use core_competency\user_competency;
+use core_competency\competency;
+use core_competency\competency_rule_all;
+use core_competency\competency_rule_points;
 
 /**
  * Competency rule testcase.
@@ -51,19 +51,19 @@ class tool_lp_competency_rule_testcase extends externallib_advanced_testcase {
         // Set up the framework and competencies.
         $framework = $lpg->create_framework();
         $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c11 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c1->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c111 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c11->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c112 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c11->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c12 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c1->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c13 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c1->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
         $c131 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c13->get_id(),
-            'ruletype' => 'tool_lp\competency_rule_all'));
+            'ruletype' => 'core_competency\competency_rule_all'));
 
         // Create some user competency records.
         $uc1 = $lpg->create_user_competency(array('competencyid' => $c1->get_id(), 'userid' => $u1->id));
@@ -106,7 +106,7 @@ class tool_lp_competency_rule_testcase extends externallib_advanced_testcase {
         $c4 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
         $cx = $lpg->create_competency(array('competencyframeworkid' => $framework2->get_id()));
 
-        $c1->set_ruletype('tool_lp\competency_rule_points');
+        $c1->set_ruletype('core_competency\competency_rule_points');
         $rule = new competency_rule_points($c1);
 
         // Invalid config.
@@ -233,7 +233,7 @@ class tool_lp_competency_rule_testcase extends externallib_advanced_testcase {
         // Set up the framework and competencies.
         $framework = $lpg->create_framework();
         $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
-        $c1->set_ruletype('tool_lp\competency_rule_points');
+        $c1->set_ruletype('core_competency\competency_rule_points');
         $comprule = new competency_rule_points($c1);
         $c11 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c1->get_id()));
         $c12 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id(), 'parentid' => $c1->get_id()));
index c0ec3c8..bea1f33 100644 (file)
@@ -25,9 +25,9 @@
 defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
-use tool_lp\course_competency;
+use core_competency\course_competency;
 use tool_lp\api;
-use tool_lp\course_competency_settings;
+use core_competency\course_competency_settings;
 
 /**
  * This test ensures that the course competency settings are applied and work correctly.
@@ -99,8 +99,8 @@ class tool_lp_course_competency_settings_testcase extends advanced_testcase {
             'userid' => $u1->id,
             'competencyid' => $comp1->get_id(),
         );
-        $usercompcourse = \tool_lp\user_competency_course::get_record($filterparams);
-        $usercomp = \tool_lp\user_competency::get_record($filterparams);
+        $usercompcourse = \core_competency\user_competency_course::get_record($filterparams);
+        $usercomp = \core_competency\user_competency::get_record($filterparams);
 
         // No grade in plan - only a grade in the course.
         $this->assertEmpty($usercomp->get_grade());
@@ -112,8 +112,8 @@ class tool_lp_course_competency_settings_testcase extends advanced_testcase {
             'userid' => $u1->id,
             'competencyid' => $comp1->get_id(),
         );
-        $usercompcourse = \tool_lp\user_competency_course::get_record($filterparams);
-        $usercomp = \tool_lp\user_competency::get_record($filterparams);
+        $usercompcourse = \core_competency\user_competency_course::get_record($filterparams);
+        $usercomp = \core_competency\user_competency::get_record($filterparams);
 
         // Updated grade in plan - updated grade in the course.
         $this->assertEquals(2, $usercomp->get_grade());
index 1e03535..bf8dbad 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
-use tool_lp\course_competency;
+use core_competency\course_competency;
 
 /**
  * Course competency persistent testcase.
index 4b66aa9..bf8334e 100644 (file)
@@ -500,7 +500,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $sink = $this->redirectEvents();
         api::create_plans_from_template_cohort($t1->get_id(), $c1->id);
         // Get our event event.
-        $plans = tool_lp\plan::get_records(array('templateid' => $t1->get_id()), 'id');
+        $plans = core_competency\plan::get_records(array('templateid' => $t1->get_id()), 'id');
         $events = $sink->get_events();
         $this->assertCount(2, $events);
         $this->assertCount(2, $plans);
@@ -1006,7 +1006,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_ACTIVE));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_ACTIVE));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1034,7 +1034,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_COMPLETE));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_COMPLETE));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1062,7 +1062,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_ACTIVE));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_ACTIVE));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1093,7 +1093,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $template = $lpg->create_template();
         $plan = $lpg->create_plan(array(
             'userid' => $user1->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE,
+            'status' => \core_competency\plan::STATUS_ACTIVE,
             'templateid' => $template->get_id()
         ));
         $planid = $plan->get_id();
@@ -1151,7 +1151,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_WAITING_FOR_REVIEW));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_WAITING_FOR_REVIEW));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1179,7 +1179,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_WAITING_FOR_REVIEW));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_WAITING_FOR_REVIEW));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1207,7 +1207,7 @@ class tool_lp_event_testcase extends advanced_testcase {
         $dg = $this->getDataGenerator();
         $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp');
         $user1 = $dg->create_user();
-        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \tool_lp\plan::STATUS_IN_REVIEW));
+        $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_IN_REVIEW));
         $planid = $plan->get_id();
         $contextid = $plan->get_context()->id;
         // Trigger and capture the event.
@@ -1321,7 +1321,7 @@ class tool_lp_event_testcase extends advanced_testcase {
 
         // Add evidence.
         $recommend = false;
-        $evidence = api::add_evidence($student->id, $comp, $syscontext, \tool_lp\evidence::ACTION_OVERRIDE,
+        $evidence = api::add_evidence($student->id, $comp, $syscontext, \core_competency\evidence::ACTION_OVERRIDE,
             'commentincontext', 'core', null, $recommend, null, 1);
 
         // Get event.
@@ -1375,12 +1375,12 @@ class tool_lp_event_testcase extends advanced_testcase {
         $comp = $lpg->create_competency(['competencyframeworkid' => $framework->get_id()]);
 
         // Create a different user competency.
-        $otheruc = \tool_lp\user_competency::create_relation($student2->id, $comp->get_id());
+        $otheruc = \core_competency\user_competency::create_relation($student2->id, $comp->get_id());
         $otheruc->create();
 
         // Add evidence.
         $recommend = false;
-        $evidence = api::add_evidence($student->id, $comp, $syscontext, \tool_lp\evidence::ACTION_OVERRIDE,
+        $evidence = api::add_evidence($student->id, $comp, $syscontext, \core_competency\evidence::ACTION_OVERRIDE,
             'commentincontext', 'core', null, $recommend, null, 1);
 
         // We expect this to fail and throw a coding exception.
@@ -1391,7 +1391,7 @@ class tool_lp_event_testcase extends advanced_testcase {
     /**
      * Test creation of evidence_created event with missing data.
      *
-     * These data are validated by \tool_lp\evidence_created::validate_data().
+     * These data are validated by \core_competency\evidence_created::validate_data().
      */
     public function test_evidence_created_with_missing_data() {
         $eventdata = [
index 09e3db1..825e871 100644 (file)
@@ -29,14 +29,15 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
 
 use tool_lp\api;
 use tool_lp\external;
-use tool_lp\plan;
-use tool_lp\related_competency;
-use tool_lp\user_competency;
-use tool_lp\user_competency_plan;
-use tool_lp\plan_competency;
-use tool_lp\template;
-use tool_lp\template_competency;
-use tool_lp\course_competency_settings;
+use core_competency\invalid_persistent_exception;
+use core_competency\plan;
+use core_competency\related_competency;
+use core_competency\user_competency;
+use core_competency\user_competency_plan;
+use core_competency\plan_competency;
+use core_competency\template;
+use core_competency\template_competency;
+use core_competency\course_competency_settings;
 
 /**
  * External learning plans webservice API tests.
@@ -590,14 +591,14 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         // Changing the framework where the scale is not used.
         $result = $this->update_competency_framework($f1->get_id(), 3, true);
 
-        $f1 = new \tool_lp\competency_framework($f1->get_id());
+        $f1 = new \core_competency\competency_framework($f1->get_id());
         $this->assertEquals(3, $f1->get_scaleid());
 
         // Changing the framework where the scale is used.
         try {
             $result = $this->update_competency_framework($f2->get_id(), 4, true);
             $this->fail('The scale cannot be changed once used.');
-        } catch (\tool_lp\invalid_persistent_exception $e) {
+        } catch (\core_competency\invalid_persistent_exception $e) {
             $this->assertRegexp('/scaleid/', $e->getMessage());
         }
     }
@@ -2260,7 +2261,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         try {
             external::add_related_competency($competency1->get_id(), $competency4->get_id());
             $this->fail('Exception expected due mis-use of shared competencies');
-        } catch (tool_lp\invalid_persistent_exception $e) {
+        } catch (invalid_persistent_exception $e) {
             // Yay!
         }
 
@@ -2369,7 +2370,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         $this->setUser($usermanage);
         $plan = array (
             'userid' => $usermanage->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE
+            'status' => \core_competency\plan::STATUS_ACTIVE
         );
         $pl1 = $lpg->create_plan($plan);
         $framework = $lpg->create_framework();
@@ -2382,7 +2383,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         $template = $lpg->create_template();
         $plan = array (
             'userid' => $usermanage->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE,
+            'status' => \core_competency\plan::STATUS_ACTIVE,
             'templateid' => $template->get_id()
         );
         $pl2 = $lpg->create_plan($plan);
@@ -2431,7 +2432,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         $this->setUser($usermanage);
         $plan = array (
             'userid' => $usermanage->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE
+            'status' => \core_competency\plan::STATUS_ACTIVE
         );
         $pl1 = $lpg->create_plan($plan);
         $framework = $lpg->create_framework();
@@ -2476,7 +2477,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
         $this->setUser($usermanage);
         $plan = array (
             'userid' => $usermanage->id,
-            'status' => \tool_lp\plan::STATUS_ACTIVE
+            'status' => \core_competency\plan::STATUS_ACTIVE
         );
         $pl1 = $lpg->create_plan($plan);
         $framework = $lpg->create_framework();
index ec0f117..494633e 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-use tool_lp\competency;
-use tool_lp\competency_framework;
-use tool_lp\course_competency;
-use tool_lp\course_module_competency;
+use core_competency\competency;
+use core_competency\competency_framework;
+use core_competency\course_competency;
+use core_competency\course_module_competency;
 use tool_lp\external;
-use tool_lp\plan;
-use tool_lp\related_competency;
-use tool_lp\template;
-use tool_lp\template_cohort;
-use tool_lp\template_competency;
-use tool_lp\user_competency;
-use tool_lp\user_competency_course;
-use tool_lp\user_competency_plan;
-use tool_lp\plan_competency;
-use tool_lp\evidence;
-use tool_lp\user_evidence;
-use tool_lp\user_evidence_competency;
+use core_competency\plan;
+use core_competency\related_competency;
+use core_competency\template;
+use core_competency\template_cohort;
+use core_competency\template_competency;
+use core_competency\user_competency;
+use core_competency\user_competency_course;
+use core_competency\user_competency_plan;
+use core_competency\plan_competency;
+use core_competency\evidence;
+use core_competency\user_evidence;
+use core_competency\user_evidence_competency;
 
 defined('MOODLE_INTERNAL') || die();
 
index e4188f9..a49de24 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-use tool_lp\competency;
-use tool_lp\competency_framework;
-use tool_lp\course_competency;
-use tool_lp\course_module_competency;
-use tool_lp\plan;
-use tool_lp\related_competency;
-use tool_lp\template;
-use tool_lp\template_cohort;
-use tool_lp\template_competency;
-use tool_lp\user_competency;
-use tool_lp\user_competency_plan;
-use tool_lp\plan_competency;
-use tool_lp\evidence;
+use core_competency\competency;
+use core_competency\competency_framework;
+use core_competency\course_competency;
+use core_competency\course_module_competency;
+use core_competency\plan;
+use core_competency\related_competency;
+use core_competency\template;
+use core_competency\template_cohort;
+use core_competency\template_competency;
+use core_competency\user_competency;
+use core_competency\user_competency_plan;
+use core_competency\plan_competency;
+use core_competency\evidence;
 
 defined('MOODLE_INTERNAL') || die();
 
@@ -57,7 +57,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $framework = $lpg->create_framework();
         $framework = $lpg->create_framework();
         $this->assertEquals(2, competency_framework::count_records());
-        $this->assertInstanceOf('\tool_lp\competency_framework', $framework);
+        $this->assertInstanceOf('\core_competency\competency_framework', $framework);
     }
 
     public function test_create_competency() {
@@ -69,7 +69,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $competency = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
         $competency = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
         $this->assertEquals(2, competency::count_records());
-        $this->assertInstanceOf('\tool_lp\competency', $competency);
+        $this->assertInstanceOf('\core_competency\competency', $competency);
     }
 
     public function test_create_related_competency() {
@@ -84,7 +84,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $rc = $lpg->create_related_competency(array('competencyid' => $c1->get_id(), 'relatedcompetencyid' => $c2->get_id()));
         $rc = $lpg->create_related_competency(array('competencyid' => $c2->get_id(), 'relatedcompetencyid' => $c3->get_id()));
         $this->assertEquals(2, related_competency::count_records());
-        $this->assertInstanceOf('\tool_lp\related_competency', $rc);
+        $this->assertInstanceOf('\core_competency\related_competency', $rc);
     }
 
     public function test_create_plan() {
@@ -95,7 +95,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $this->assertEquals(0, plan::count_records());
         $plan = $lpg->create_plan(array('userid' => $user->id));
         $this->assertEquals(1, plan::count_records());
-        $this->assertInstanceOf('\tool_lp\plan', $plan);
+        $this->assertInstanceOf('\core_competency\plan', $plan);
     }
 
     public function test_create_user_competency() {
@@ -111,7 +111,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $rc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c1->get_id()));
         $rc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c2->get_id()));
         $this->assertEquals(2, user_competency::count_records());
-        $this->assertInstanceOf('\tool_lp\user_competency', $rc);
+        $this->assertInstanceOf('\core_competency\user_competency', $rc);
     }
 
     public function test_create_user_competency_plan() {
@@ -135,7 +135,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
                                                      'planid' => $plan->get_id()
                                                 ));
         $this->assertEquals(2, user_competency_plan::count_records());
-        $this->assertInstanceOf('\tool_lp\user_competency_plan', $ucp);
+        $this->assertInstanceOf('\core_competency\user_competency_plan', $ucp);
     }
 
     public function test_create_template() {
@@ -146,7 +146,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $template = $lpg->create_template();
         $template = $lpg->create_template();
         $this->assertEquals(2, template::count_records());
-        $this->assertInstanceOf('\tool_lp\template', $template);
+        $this->assertInstanceOf('\core_competency\template', $template);
     }
 
     public function test_create_template_competency() {
@@ -161,7 +161,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $relation = $lpg->create_template_competency(array('competencyid' => $c1->get_id(), 'templateid' => $template->get_id()));
         $relation = $lpg->create_template_competency(array('competencyid' => $c2->get_id(), 'templateid' => $template->get_id()));
         $this->assertEquals(2, template_competency::count_records());
-        $this->assertInstanceOf('\tool_lp\template_competency', $relation);
+        $this->assertInstanceOf('\core_competency\template_competency', $relation);
     }
 
     public function test_create_plan_competency() {
@@ -179,8 +179,8 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $pc2 = $lpg->create_plan_competency(array('planid' => $plan->get_id(), 'competencyid' => $c2->get_id()));
 
         $this->assertEquals(2, plan_competency::count_records());
-        $this->assertInstanceOf('\tool_lp\plan_competency', $pc1);
-        $this->assertInstanceOf('\tool_lp\plan_competency', $pc2);
+        $this->assertInstanceOf('\core_competency\plan_competency', $pc1);
+        $this->assertInstanceOf('\core_competency\plan_competency', $pc2);
         $this->assertEquals($plan->get_id(), $pc1->get_planid());
     }
 
@@ -196,7 +196,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $this->assertEquals(1, template_cohort::count_records());
         $tc = $lpg->create_template_cohort(array('templateid' => $t1->get_id(), 'cohortid' => $c2->id));
         $this->assertEquals(2, template_cohort::count_records());
-        $this->assertInstanceOf('\tool_lp\template_cohort', $tc);
+        $this->assertInstanceOf('\core_competency\template_cohort', $tc);
     }
 
     public function test_create_evidence() {
@@ -212,7 +212,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $e = $lpg->create_evidence(array('usercompetencyid' => $rc1->get_id()));
         $e = $lpg->create_evidence(array('usercompetencyid' => $rc2->get_id()));
         $this->assertEquals(2, evidence::count_records());
-        $this->assertInstanceOf('\tool_lp\evidence', $e);
+        $this->assertInstanceOf('\core_competency\evidence', $e);
     }
 
     public function test_create_course_competency() {
@@ -232,7 +232,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $this->assertEquals(0, course_competency::count_records(array('courseid' => $course2->id)));
         $rc = $lpg->create_course_competency(array('competencyid' => $c3->get_id(), 'courseid' => $course2->id));
         $this->assertEquals(1, course_competency::count_records(array('courseid' => $course2->id)));
-        $this->assertInstanceOf('\tool_lp\course_competency', $rc);
+        $this->assertInstanceOf('\core_competency\course_competency', $rc);
     }
 
     public function test_create_course_module_competency() {
@@ -253,7 +253,7 @@ class tool_lp_generator_testcase extends advanced_testcase {
         $this->assertEquals(0, course_module_competency::count_records(array('cmid' => $cm2->cmid)));
         $rc = $lpg->create_course_module_competency(array('competencyid' => $c3->get_id(), 'cmid' => $cm2->cmid));
         $this->assertEquals(1, course_module_competency::count_records(array('cmid' => $cm2->cmid)));
-        $this->assertInstanceOf('\tool_lp\course_module_competency', $rc);
+        $this->assertInstanceOf('\core_competency\course_module_competency', $rc);
     }
 
 }
index 567463b..45235af 100644 (file)
@@ -24,8 +24,8 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-use tool_lp\plan;
-use tool_lp\user_competency;
+use core_competency\plan;
+use core_competency\user_competency;
 
 global $CFG;
 
index cb444ee..377ba4f 100644 (file)
@@ -401,7 +401,7 @@ class tool_lp_persistent_testcase extends advanced_testcase {
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class tool_lp_testable_persistent extends \tool_lp\persistent {
+class tool_lp_testable_persistent extends \core_competency\persistent {
 
     const TABLE = 'competency';
 
index 75caff7..02f6eeb 100644 (file)
@@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
 use tool_lp\api;
-use tool_lp\plan;
+use core_competency\plan;
 
 /**
  * Plan persistent testcase.
index 79fac98..cb96ff6 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
-use tool_lp\plan;
+use core_competency\plan;
 
 /**
  * Plan persistent testcase.
@@ -60,19 +60,19 @@ class tool_lp_plan_testcase extends advanced_testcase {
         accesslib_clear_all_caches_for_unit_testing();
 
         $this->setUser($u1);
-        $this->assertTrue(\tool_lp\plan::can_manage_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user($u2->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user($u3->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user($u2->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user($u3->id));
 
         $this->setUser($u2);
-        $this->assertFalse(\tool_lp\plan::can_manage_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user($u3->id));
 
         $this->setUser($u3);
-        $this->assertFalse(\tool_lp\plan::can_manage_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user($u3->id));
     }
 
     public function test_can_manage_user_draft() {
@@ -109,39 +109,39 @@ class tool_lp_plan_testcase extends advanced_testcase {
         accesslib_clear_all_caches_for_unit_testing();
 
         $this->setUser($u1);
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u5->id));
 
         $this->setUser($u2);
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u5->id));
 
         $this->setUser($u3);
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u2->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u3->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u4->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u5->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u1->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u2->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u3->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u4->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u5->id));
 
         $this->setUser($u4);
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u1->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u5->id));
 
         $this->setUser($u5);
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_manage_user_draft($u4->id));
-        $this->assertTrue(\tool_lp\plan::can_manage_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_manage_user_draft($u4->id));
+        $this->assertTrue(\core_competency\plan::can_manage_user_draft($u5->id));
     }
 
     public function test_can_read_user() {
@@ -168,19 +168,19 @@ class tool_lp_plan_testcase extends advanced_testcase {
         accesslib_clear_all_caches_for_unit_testing();
 
         $this->setUser($u1);
-        $this->assertTrue(\tool_lp\plan::can_read_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user($u2->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user($u3->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u2->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u3->id));
 
         $this->setUser($u2);
-        $this->assertFalse(\tool_lp\plan::can_read_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user($u3->id));
+        $this->assertFalse(\core_competency\plan::can_read_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u2->id));
+        $this->assertFalse(\core_competency\plan::can_read_user($u3->id));
 
         $this->setUser($u3);
-        $this->assertFalse(\tool_lp\plan::can_read_user($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user($u2->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user($u3->id));    // Due to the default capability.
+        $this->assertFalse(\core_competency\plan::can_read_user($u1->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u2->id));
+        $this->assertTrue(\core_competency\plan::can_read_user($u3->id));    // Due to the default capability.
     }
 
     public function test_can_read_user_draft() {
@@ -218,39 +218,39 @@ class tool_lp_plan_testcase extends advanced_testcase {
         accesslib_clear_all_caches_for_unit_testing();
 
         $this->setUser($u1);
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u5->id));
 
         $this->setUser($u2);
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u5->id));
 
         $this->setUser($u3);
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u2->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u3->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u4->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u5->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u1->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u2->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u3->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u4->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u5->id));
 
         $this->setUser($u4);
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u1->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u4->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u1->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u4->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u5->id));
 
         $this->setUser($u5);
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u1->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u2->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u3->id));
-        $this->assertFalse(\tool_lp\plan::can_read_user_draft($u4->id));
-        $this->assertTrue(\tool_lp\plan::can_read_user_draft($u5->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u1->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u2->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u3->id));
+        $this->assertFalse(\core_competency\plan::can_read_user_draft($u4->id));
+        $this->assertTrue(\core_competency\plan::can_read_user_draft($u5->id));
     }
 
     public function test_validate_duedate() {
@@ -262,15 +262,15 @@ class tool_lp_plan_testcase extends advanced_testcase {
         $user = $dg->create_user();
 
         $record = array('userid' => $user->id,
-                        'status' => tool_lp\plan::STATUS_DRAFT,
+                        'status' => core_competency\plan::STATUS_DRAFT,
                         'duedate' => time() - 8000);
 
         // Ignore duedate validation on create/update draft plan.
         $plan = $lpg->create_plan($record);
-        $this->assertInstanceOf('\tool_lp\plan', $plan);
+        $this->assertInstanceOf('\core_competency\plan', $plan);
 
         // Passing from draft to active.
-        $plan->set_status(tool_lp\plan::STATUS_ACTIVE);
+        $plan->set_status(core_competency\plan::STATUS_ACTIVE);
 
         // Draft to active with duedate in the past.
         $expected = array(
@@ -293,7 +293,7 @@ class tool_lp_plan_testcase extends advanced_testcase {
         $this->assertEquals($expected, $plan->validate());
 
         // Draft to active: past date => future date (pass).
-        $plan->set_duedate(time() + tool_lp\plan::DUEDATE_THRESHOLD + 10);
+        $plan->set_duedate(time() + core_competency\plan::DUEDATE_THRESHOLD + 10);
         $this->assertEquals(true, $plan->validate());
 
         // Draft to active: past date => unset date (pass).
@@ -335,7 +335,7 @@ class tool_lp_plan_testcase extends advanced_testcase {
         $this->assertEquals($expected, $plan->validate());
 
         // Active to active: unset date => future date (pass).
-        $plan->set_duedate(time() + tool_lp\plan::DUEDATE_THRESHOLD + 10);
+        $plan->set_duedate(time() + core_competency\plan::DUEDATE_THRESHOLD + 10);
         $this->assertEquals(true, $plan->validate());
 
         // Updating active plan with future date.
@@ -364,50 +364,50 @@ class tool_lp_plan_testcase extends advanced_testcase {
         $this->assertEquals($expected, $plan->validate());
 
         // Active to active: future date => future date (pass).
-        $plan->set_duedate(time() + tool_lp\plan::DUEDATE_THRESHOLD + 10);
+        $plan->set_duedate(time() + core_competency\plan::DUEDATE_THRESHOLD + 10);
         $this->assertEquals(true, $plan->validate());
 
         // Completing plan: with due date in the past.
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_ACTIVE;
+        $record->status = core_competency\plan::STATUS_ACTIVE;
         $record->duedate = time() - 200;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::complete_plan($plan->get_id());
         $this->assertTrue($success);
 
         // Completing plan: with due date too soon (pass).
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_ACTIVE;
+        $record->status = core_competency\plan::STATUS_ACTIVE;
         $record->duedate = time() + 200;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::complete_plan($plan->get_id());
         $this->assertTrue($success);
 
         // Completing plan: with due date in the future (pass).
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_ACTIVE;
-        $record->duedate = time() + tool_lp\plan::DUEDATE_THRESHOLD + 10;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $record->status = core_competency\plan::STATUS_ACTIVE;
+        $record->duedate = time() + core_competency\plan::DUEDATE_THRESHOLD + 10;
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::complete_plan($plan->get_id());
         $this->assertTrue($success);
 
         // Completing plan: with due date unset (pass).
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_ACTIVE;
+        $record->status = core_competency\plan::STATUS_ACTIVE;
         $record->duedate = 0;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::complete_plan($plan->get_id());
         $this->assertTrue($success);
 
         // Reopening plan: with due date in the past => duedate unset.
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_COMPLETE;
+        $record->status = core_competency\plan::STATUS_COMPLETE;
         $record->duedate = time() - 200;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::reopen_plan($plan->get_id());
         $this->assertTrue($success);
@@ -416,9 +416,9 @@ class tool_lp_plan_testcase extends advanced_testcase {
 
         // Reopening plan: with due date too soon => duedate unset.
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_COMPLETE;
+        $record->status = core_competency\plan::STATUS_COMPLETE;
         $record->duedate = time() + 100;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::reopen_plan($plan->get_id());
         $this->assertTrue($success);
@@ -427,17 +427,17 @@ class tool_lp_plan_testcase extends advanced_testcase {
 
         // Reopening plan: with due date in the future => duedate unchanged.
         $record = $plan->to_record();
-        $record->status = tool_lp\plan::STATUS_COMPLETE;
-        $record->duedate = time() + tool_lp\plan::DUEDATE_THRESHOLD + 10;
-        $DB->update_record(tool_lp\plan::TABLE, $record);
+        $record->status = core_competency\plan::STATUS_COMPLETE;
+        $record->duedate = time() + core_competency\plan::DUEDATE_THRESHOLD + 10;
+        $DB->update_record(core_competency\plan::TABLE, $record);
 
         $success = tool_lp\api::reopen_plan($plan->get_id());
         $this->assertTrue($success);
         $plan->read();
 
         // Check that the due date has not changed, but allow for PHP Unit latency.
-        $this->assertTrue($plan->get_duedate() >= time() + tool_lp\plan::DUEDATE_THRESHOLD + 10);
-        $this->assertTrue($plan->get_duedate() <= time() + tool_lp\plan::DUEDATE_THRESHOLD + 15);
+        $this->assertTrue($plan->get_duedate() >= time() + core_competency\plan::DUEDATE_THRESHOLD + 10);
+        $this->assertTrue($plan->get_duedate() <= time() + core_competency\plan::DUEDATE_THRESHOLD + 15);
 
     }
 }
index 3d175d2..15e3de9 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 use tool_lp\api;
-use tool_lp\plan;
+use core_competency\plan;
 
 /**
  * Task tests.
@@ -46,8 +46,8 @@ class tool_lp_task_testcase extends advanced_testcase {
 
         // Sql to simulate the execution in time.
         $cmsql = "UPDATE {cohort_members} SET timeadded = :currenttime WHERE cohortid = :cohortid AND userid = :userid";
-        $tplsql = "UPDATE {" . \tool_lp\template::TABLE . "} SET timemodified = :currenttime WHERE id = :templateid";
-        $plansql = "UPDATE {" . \tool_lp\plan::TABLE . "} SET timemodified = :currenttime WHERE id = :planid";
+        $tplsql = "UPDATE {" . \core_competency\template::TABLE . "} SET timemodified = :currenttime WHERE id = :templateid";
+        $plansql = "UPDATE {" . \core_competency\plan::TABLE . "} SET timemodified = :currenttime WHERE id = :planid";
 
         $currenttime = time();
 
@@ -255,22 +255,22 @@ class tool_lp_task_testcase extends advanced_testcase {
 
         // Creating plans from template cohort.
         $task->execute();
-        $this->assertEquals(1, \tool_lp\plan::count_records());
+        $this->assertEquals(1, \core_competency\plan::count_records());
 
         // Now add another user, but this time the template will be expired.
         cohort_add_member($cohort->id, $user2->id);
         $record = $tpl->to_record();
         $record->duedate = time() - 10000;
-        $DB->update_record(\tool_lp\template::TABLE, $record);
+        $DB->update_record(\core_competency\template::TABLE, $record);
         $tpl->read();
         $task->execute();
-        $this->assertEquals(1, \tool_lp\plan::count_records()); // Still only one plan.
+        $this->assertEquals(1, \core_competency\plan::count_records()); // Still only one plan.
 
         // Pretend it wasn't expired.
         $tpl->set_duedate(time() + 100);
         $tpl->update();
         $task->execute();
-        $this->assertEquals(2, \tool_lp\plan::count_records()); // Now there is two.
+        $this->assertEquals(2, \core_competency\plan::count_records()); // Now there is two.
     }
 
     public function test_complete_plans_task() {
@@ -283,9 +283,9 @@ class tool_lp_task_testcase extends advanced_testcase {
         $user = $dg->create_user();
 
         $up1 = $lpg->create_plan(array('userid' => $user->id,
-                                        'status' => \tool_lp\plan::STATUS_DRAFT));
+                                        'status' => \core_competency\plan::STATUS_DRAFT));
         $up2 = $lpg->create_plan(array('userid' => $user->id,
-                                        'status' => \tool_lp\plan::STATUS_ACTIVE));
+                                        'status' => \core_competency\plan::STATUS_ACTIVE));
         // Set duedate in the past.
         $date = new \DateTime('yesterday');
         $record1 = $up1->to_record();
@@ -303,12 +303,12 @@ class tool_lp_task_testcase extends advanced_testcase {
         $task->execute();
 
         $plandraft = api::read_plan($up1->get_id());
-        $this->assertEquals(\tool_lp\plan::STATUS_DRAFT, $plandraft->get_status());
+        $this->assertEquals(\core_competency\plan::STATUS_DRAFT, $plandraft->get_status());
 
         // Test that active plan can be completed on running task.
         $task->execute();
 
         $planactive = api::read_plan($up2->get_id());
-        $this->assertEquals(\tool_lp\plan::STATUS_COMPLETE, $planactive->get_status());
+        $this->assertEquals(\core_competency\plan::STATUS_COMPLETE, $planactive->get_status());
     }
 }
index e28a463..edd94d9 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
-use tool_lp\template;
+use core_competency\template;
 
 /**
  * Template persistent testcase.
index 7262117..309e152 100644 (file)
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 global $CFG;
 
-use tool_lp\user_evidence_competency;
+use core_competency\user_evidence_competency;
 
 /**
  * User evidence competency persistent testcase.
index 8de8b94..ba2f079 100644 (file)
@@ -60,7 +60,7 @@ if ($userid > 0) {
     $usercontext = context_user::instance($userid);
     $user = $DB->get_record('user', array('id' => $userid));
 }
-$competency = new \tool_lp\competency($competencyid);
+$competency = new \core_competency\competency($competencyid);
 
 // Does a permissions check for us.
 if ($userid > 0) {
index 3698b40..b042da2 100644 (file)
@@ -38,7 +38,7 @@ $params = array('userid' => $userid, 'competencyid' => $competencyid);
 $params['planid'] = $planid;
 $plan = \tool_lp\api::read_plan($planid);
 $url = new moodle_url('/admin/tool/lp/user_competency_in_plan.php', $params);
-$competency = new \tool_lp\competency($competencyid);
+$competency = new \core_competency\competency($competencyid);
 $framework = $competency->get_framework();
 
 list($title, $subtitle) = \tool_lp\page_helper::setup_for_plan($userid, $url, $plan);
@@ -51,7 +51,7 @@ $page = new \tool_lp\output\user_competency_summary_in_plan($competencyid, $plan
 echo $output->render($page);
 // Trigger the viewed event.
 $pc = \tool_lp\api::get_plan_competency($plan, $competency->get_id());
-if ($plan->get_status() == \tool_lp\plan::STATUS_COMPLETE) {
+if ($plan->get_status() == \core_competency\plan::STATUS_COMPLETE) {
     $usercompetencyplan = $pc->usercompetencyplan;
     \tool_lp\api::user_competency_plan_viewed($usercompetencyplan);
 } else {
index a845732..19f6755 100644 (file)
@@ -72,7 +72,7 @@ if ($userevidence != null) {
     }
     $customdata['evidence'] = $userevidence;
 
-} else if (!\tool_lp\user_evidence::can_manage_user($userid)) {
+} else if (!\core_competency\user_evidence::can_manage_user($userid)) {
     throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
 }
 
similarity index 98%
rename from admin/tool/lp/classes/competency.php
rename to competency/classes/competency.php
index 85eb709..ff98734 100644 (file)
 /**
  * Class for loading/storing competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -294,7 +294,7 @@ class competency extends persistent {
     public function get_rule_object() {
         $rule = $this->get_ruletype();
 
-        if (!$rule || !is_subclass_of($rule, 'tool_lp\\competency_rule')) {
+        if (!$rule || !is_subclass_of($rule, 'core_competency\\competency_rule')) {
             // Double check that the rule is extending the right class to avoid bad surprises.
             return null;
         }
@@ -555,7 +555,7 @@ class competency extends persistent {
             return true;
         }
 
-        if (!class_exists($value) || !is_subclass_of($value, '\tool_lp\competency_rule')) {
+        if (!class_exists($value) || !is_subclass_of($value, 'core_competency\\competency_rule')) {
             return new lang_string('invaliddata', 'error');
         }
 
@@ -629,7 +629,7 @@ class competency extends persistent {
     /**
      * Validate the scale configuration.
      *
-     * This logic is adapted from {@link \tool_lp\competency_framework::validate_scaleconfiguration()}.
+     * This logic is adapted from {@link \core_competency\competency_framework::validate_scaleconfiguration()}.
      *
      * @param  string $value The scale configuration.
      * @return bool|lang_string
@@ -691,8 +691,8 @@ class competency extends persistent {
     public static function get_available_rules() {
         // Fully qualified class names without leading slashes because get_class() does not add them either.
         $rules = array(
-            'tool_lp\\competency_rule_all' => (object) array(),
-            'tool_lp\\competency_rule_points' => (object) array(),
+            'core_competency\\competency_rule_all' => (object) array(),
+            'core_competency\\competency_rule_points' => (object) array(),
         );
         foreach ($rules as $class => $rule) {
             $rule->name = $class::get_name();
similarity index 99%
rename from admin/tool/lp/classes/competency_framework.php
rename to competency/classes/competency_framework.php
index cd7c9e0..0793caf 100644 (file)
 /**
  * Class for loading/storing competency frameworks from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
similarity index 97%
rename from admin/tool/lp/classes/competency_rule.php
rename to competency/classes/competency_rule.php
index 41c2c7d..551de30 100644 (file)
 /**
  * Competency rule base.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -33,7 +33,7 @@ use coding_exception;
  * Rules are attached to a competency and then tested against a user competency
  * to determine whether or not it matches.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
similarity index 97%
rename from admin/tool/lp/classes/competency_rule_all.php
rename to competency/classes/competency_rule_all.php
index abfb938..4ad6d48 100644 (file)
 /**
  * Competency rule all.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use lang_string;
@@ -32,7 +32,7 @@ use lang_string;
  *
  * This rule is considered matched when all the children of a competency are completed.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 /**
  * Competency rule points based.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -34,7 +34,7 @@ use lang_string;
  *
  * This rule matches when related competencies contribute for a required number of points.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
similarity index 99%
rename from admin/tool/lp/classes/course_competency.php
rename to competency/classes/course_competency.php
index 6916042..949a3c2 100644 (file)
 /**
  * Class for loading/storing competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
 /**
  * Class for course_competency_settings persistence.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2016 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 
 use lang_string;
 use context_course;
 /**
  * Class for loading/storing competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use stdClass;
similarity index 98%
rename from admin/tool/lp/classes/evidence.php
rename to competency/classes/evidence.php
index ec8ff34..402df86 100644 (file)
 /**
  * Evidence persistent file.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -34,7 +34,7 @@ use stdClass;
 /**
  * Evidence persistent class.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 /**
  * Invalid persistent exception.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 
 defined('MOODLE_INTERNAL') || die();
 
 /**
  * Invalid persistent exception class.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -40,7 +40,7 @@ class invalid_persistent_exception extends \moodle_exception {
         foreach ($errors as $key => $message) {
             $debuginfo[] = "$key: $message";
         }
-        parent::__construct('invalidpersistent', 'tool_lp', null, null, implode(' - ', $debuginfo));
+        parent::__construct('invalidpersistent', 'core_competency', null, null, implode(' - ', $debuginfo));
     }
 
 }
similarity index 98%
rename from admin/tool/lp/classes/persistent.php
rename to competency/classes/persistent.php
index 159beb2..7db1c48 100644 (file)
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * Abstract class for tool_lp objects saved to the DB.
+ * Abstract class for core_competency objects saved to the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -32,7 +32,7 @@ use stdClass;
 use renderer_base;
 
 /**
- * Abstract class for tool_lp objects saved to the DB.
+ * Abstract class for core_competency objects saved to the DB.
  *
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -691,7 +691,7 @@ abstract class persistent {
      */
     public static function extract_record($row, $prefix = null) {
         if ($prefix === null) {
-            $prefix = static::TABLE . '_';
+            $prefix = str_replace('_', '', static::TABLE) . '_';
         }
         $prefixlength = strlen($prefix);
 
@@ -715,7 +715,7 @@ abstract class persistent {
      * @param int $skip Limitstart.
      * @param int $limit Number of rows to return.
      *
-     * @return \tool_lp\persistent[]
+     * @return \core_competency\persistent[]
      */
     public static function get_records($filters = array(), $sort = '', $order = 'ASC', $skip = 0, $limit = 0) {
         global $DB;
@@ -739,7 +739,7 @@ abstract class persistent {
      * Load a single record.
      *
      * @param array $filters Filters to apply.
-     * @return false|\tool_lp\persistent
+     * @return false|\core_competency\persistent
      */
     public static function get_record($filters = array()) {
         global $DB;
@@ -757,7 +757,7 @@ abstract class persistent {
      * @param string $fields
      * @param int $limitfrom
      * @param int $limitnum
-     * @return \tool_lp\persistent[]
+     * @return \core_competency\persistent[]
      */
     public static function get_records_select($select, $params = null, $sort = '', $fields = '*', $limitfrom = 0, $limitnum = 0) {
         global $DB;
@@ -788,7 +788,7 @@ abstract class persistent {
         $fields = array();
 
         if ($prefix === null) {
-            $prefix = static::TABLE . '_';
+            $prefix = str_replace('_', '', static::TABLE) . '_';
         }
 
         // Get the properties and move ID to the top.
similarity index 99%
rename from admin/tool/lp/classes/plan.php
rename to competency/classes/plan.php
index f50b39a..9215b22 100644 (file)
 /**
  * Class for plans persistence.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 David Monllao
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use comment;
similarity index 98%
rename from admin/tool/lp/classes/plan_competency.php
rename to competency/classes/plan_competency.php
index b1bfb74..d45ec01 100644 (file)
 /**
  * Class for plan_competency persistence.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Issam Taboubi <issam.taboubi@umontreal.ca>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use lang_string;
similarity index 98%
rename from admin/tool/lp/classes/related_competency.php
rename to competency/classes/related_competency.php
index a9efdc3..6771182 100644 (file)
 /**
  * Class for loading/storing related competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 David Monllao
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use lang_string;
@@ -30,7 +30,7 @@ use stdClass;
 /**
  * Class for loading/storing related_competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 David Monllao
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
similarity index 99%
rename from admin/tool/lp/classes/template.php
rename to competency/classes/template.php
index 7220570..984a97d 100644 (file)
 /**
  * Class for loading/storing learning plan templates from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use context;
similarity index 97%
rename from admin/tool/lp/classes/template_cohort.php
rename to competency/classes/template_cohort.php
index bf59da9..5387c06 100644 (file)
 /**
  * Template cohort persistent.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use lang_string;
-use tool_lp\template;
+use core_competency\template;
 
 /**
  * Template cohort persistent.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Frédéric Massart - FMCorz.net
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
@@ -182,7 +182,7 @@ class template_cohort extends persistent {
      * @param int $lastruntime  The last time the Cohort ssync task ran.
      * @param bool $unlinkedaremissing When true, unlinked plans are considered as missing.
      * @return array( array(
-     *                   'template' => \tool_lp\template,
+     *                   'template' => \core_competency\template,
      *                   'userids' => array
      *              ))
      */
similarity index 99%
rename from admin/tool/lp/classes/template_competency.php
rename to competency/classes/template_competency.php
index dc083b1..8b24882 100644 (file)
 /**
  * Class for loading/storing competencies from the DB.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Damyon Wiese
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use stdClass;
similarity index 99%
rename from admin/tool/lp/classes/user_competency.php
rename to competency/classes/user_competency.php
index 1b5e443..1a882b5 100644 (file)
 /**
  * Class for user_competency persistence.
  *
- * @package    tool_lp
+ * @package    core_competency
  * @copyright  2015 Serge Gauthier
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-namespace tool_lp;
+namespace core_competency;
 defined('MOODLE_INTERNAL') || die();
 
 use coding_exception;
@@ -451,7 +451,7 @@ class user_competency extends persistent {
      *
      * @param  int $userid The user ID.
      * @param  int $competencyid The competency ID.
-     * @return \tool_lp\user_competency
+     * @return \core_competency\user_competency
      */
   &n