diff --git a/admin/tool/lp/classes/competency.php b/admin/tool/lp/classes/competency.php
index 59297929407..85eb709e2df 100644
--- a/admin/tool/lp/classes/competency.php
+++ b/admin/tool/lp/classes/competency.php
@@ -39,7 +39,7 @@ require_once($CFG->libdir . '/grade/grade_scale.php');
*/
class competency extends persistent {
- const TABLE = 'tool_lp_competency';
+ const TABLE = 'competency';
/** Outcome none. */
const OUTCOME_NONE = 0;
diff --git a/admin/tool/lp/classes/competency_framework.php b/admin/tool/lp/classes/competency_framework.php
index 8e19658393e..cd7c9e05cca 100644
--- a/admin/tool/lp/classes/competency_framework.php
+++ b/admin/tool/lp/classes/competency_framework.php
@@ -39,7 +39,7 @@ require_once($CFG->libdir . '/grade/grade_scale.php');
*/
class competency_framework extends persistent {
- const TABLE = 'tool_lp_competency_framework';
+ const TABLE = 'competency_framework';
/** Taxonomy constant. */
const TAXONOMY_BEHAVIOUR = 'behaviour';
diff --git a/admin/tool/lp/classes/course_competency.php b/admin/tool/lp/classes/course_competency.php
index b1d0f3c65ed..6916042347a 100644
--- a/admin/tool/lp/classes/course_competency.php
+++ b/admin/tool/lp/classes/course_competency.php
@@ -36,7 +36,7 @@ use lang_string;
*/
class course_competency extends persistent {
- const TABLE = 'tool_lp_course_competency';
+ const TABLE = 'competency_coursecomp';
/** Course competency ruleoutcome constant. */
const OUTCOME_NONE = 0;
diff --git a/admin/tool/lp/classes/course_competency_settings.php b/admin/tool/lp/classes/course_competency_settings.php
index 88b55fdb8d4..f7986c21ad5 100644
--- a/admin/tool/lp/classes/course_competency_settings.php
+++ b/admin/tool/lp/classes/course_competency_settings.php
@@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die();
class course_competency_settings extends persistent {
/** Table name for plan_competency persistency */
- const TABLE = 'tool_lp_coursecompsettings';
+ const TABLE = 'competency_coursecompsetting';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/course_module_competency.php b/admin/tool/lp/classes/course_module_competency.php
index bcddd14e93e..9bfefaa1dc6 100644
--- a/admin/tool/lp/classes/course_module_competency.php
+++ b/admin/tool/lp/classes/course_module_competency.php
@@ -35,7 +35,7 @@ use lang_string;
*/
class course_module_competency extends persistent {
- const TABLE = 'tool_lp_module_competency';
+ const TABLE = 'competency_modulecomp';
/** Course competency ruleoutcome constant. */
const OUTCOME_NONE = 0;
diff --git a/admin/tool/lp/classes/evidence.php b/admin/tool/lp/classes/evidence.php
index 75a1cf72d10..ec8ff342884 100644
--- a/admin/tool/lp/classes/evidence.php
+++ b/admin/tool/lp/classes/evidence.php
@@ -40,7 +40,7 @@ use stdClass;
*/
class evidence extends persistent {
- const TABLE = 'tool_lp_evidence';
+ const TABLE = 'competency_evidence';
/** Action logging. */
const ACTION_LOG = 0;
diff --git a/admin/tool/lp/classes/plan.php b/admin/tool/lp/classes/plan.php
index fbb4655ed3f..f50b39a9298 100644
--- a/admin/tool/lp/classes/plan.php
+++ b/admin/tool/lp/classes/plan.php
@@ -37,7 +37,7 @@ use lang_string;
*/
class plan extends persistent {
- const TABLE = 'tool_lp_plan';
+ const TABLE = 'competency_plan';
/** Draft status. */
const STATUS_DRAFT = 0;
diff --git a/admin/tool/lp/classes/plan_competency.php b/admin/tool/lp/classes/plan_competency.php
index bb80da2039b..b1bfb74ad5d 100644
--- a/admin/tool/lp/classes/plan_competency.php
+++ b/admin/tool/lp/classes/plan_competency.php
@@ -35,7 +35,7 @@ use lang_string;
class plan_competency extends persistent {
/** Table name for plan_competency persistency */
- const TABLE = 'tool_lp_plan_competency';
+ const TABLE = 'competency_plancomp';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/related_competency.php b/admin/tool/lp/classes/related_competency.php
index be5f3992c40..a9efdc34379 100644
--- a/admin/tool/lp/classes/related_competency.php
+++ b/admin/tool/lp/classes/related_competency.php
@@ -36,7 +36,7 @@ use stdClass;
*/
class related_competency extends persistent {
- const TABLE = 'tool_lp_related_competency';
+ const TABLE = 'competency_relatedcomp';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/template.php b/admin/tool/lp/classes/template.php
index 01f16c901bd..7220570f0f8 100644
--- a/admin/tool/lp/classes/template.php
+++ b/admin/tool/lp/classes/template.php
@@ -36,7 +36,7 @@ use stdClass;
*/
class template extends persistent {
- const TABLE = 'tool_lp_template';
+ const TABLE = 'competency_template';
/** @var template object before update. */
protected $beforeupdate = null;
diff --git a/admin/tool/lp/classes/template_cohort.php b/admin/tool/lp/classes/template_cohort.php
index 2a06187e241..bf59da96fe3 100644
--- a/admin/tool/lp/classes/template_cohort.php
+++ b/admin/tool/lp/classes/template_cohort.php
@@ -37,7 +37,7 @@ use tool_lp\template;
*/
class template_cohort extends persistent {
- const TABLE = 'tool_lp_template_cohort';
+ const TABLE = 'competency_templatecohort';
/** 2 hours of threshold to prevent expired plans **/
const DUEDATE_THRESHOLD = 7200;
diff --git a/admin/tool/lp/classes/template_competency.php b/admin/tool/lp/classes/template_competency.php
index c1735daba0e..dc083b15377 100644
--- a/admin/tool/lp/classes/template_competency.php
+++ b/admin/tool/lp/classes/template_competency.php
@@ -34,7 +34,7 @@ use stdClass;
*/
class template_competency extends persistent {
- const TABLE = 'tool_lp_template_competency';
+ const TABLE = 'competency_templatecomp';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/user_competency.php b/admin/tool/lp/classes/user_competency.php
index a885798ba28..1b5e443c7e7 100644
--- a/admin/tool/lp/classes/user_competency.php
+++ b/admin/tool/lp/classes/user_competency.php
@@ -39,7 +39,7 @@ use lang_string;
class user_competency extends persistent {
/** Table name for user_competency persistency */
- const TABLE = 'tool_lp_user_competency';
+ const TABLE = 'competency_usercomp';
/** Idle status */
const STATUS_IDLE = 0;
diff --git a/admin/tool/lp/classes/user_competency_course.php b/admin/tool/lp/classes/user_competency_course.php
index 056291427d0..f305f6309ae 100644
--- a/admin/tool/lp/classes/user_competency_course.php
+++ b/admin/tool/lp/classes/user_competency_course.php
@@ -37,7 +37,7 @@ use lang_string;
class user_competency_course extends persistent {
/** Table name for user_competency persistency */
- const TABLE = 'tool_lp_user_comp_course';
+ const TABLE = 'competency_usercompcourse';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/user_competency_plan.php b/admin/tool/lp/classes/user_competency_plan.php
index 0920a04019d..11358b3c944 100644
--- a/admin/tool/lp/classes/user_competency_plan.php
+++ b/admin/tool/lp/classes/user_competency_plan.php
@@ -36,7 +36,7 @@ use context_user;
class user_competency_plan extends persistent {
/** Table name for user_competency_plan persistency */
- const TABLE = 'tool_lp_user_competency_plan';
+ const TABLE = 'competency_usercompplan';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/user_evidence.php b/admin/tool/lp/classes/user_evidence.php
index 55d3141eff0..dc5b266d112 100644
--- a/admin/tool/lp/classes/user_evidence.php
+++ b/admin/tool/lp/classes/user_evidence.php
@@ -37,7 +37,7 @@ use lang_string;
*/
class user_evidence extends persistent {
- const TABLE = 'tool_lp_user_evidence';
+ const TABLE = 'competency_userevidence';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/classes/user_evidence_competency.php b/admin/tool/lp/classes/user_evidence_competency.php
index 205f83e1252..d6e12325d8b 100644
--- a/admin/tool/lp/classes/user_evidence_competency.php
+++ b/admin/tool/lp/classes/user_evidence_competency.php
@@ -39,7 +39,7 @@ use lang_string;
*/
class user_evidence_competency extends persistent {
- const TABLE = 'tool_lp_user_evidence_comp';
+ const TABLE = 'competency_userevidencecomp';
/**
* Return the definition of the properties of this model.
diff --git a/admin/tool/lp/db/install.xml b/admin/tool/lp/db/install.xml
deleted file mode 100755
index 0f2a93349aa..00000000000
--- a/admin/tool/lp/db/install.xml
+++ /dev/null
@@ -1,339 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/admin/tool/lp/db/upgrade.php b/admin/tool/lp/db/upgrade.php
deleted file mode 100644
index 10eedfdfb51..00000000000
--- a/admin/tool/lp/db/upgrade.php
+++ /dev/null
@@ -1,863 +0,0 @@
-.
-
-/**
- * Leaning plan upgrade steps.
- *
- * @package tool_lp
- * @copyright 2015 Frédéric Massart - FMCorz.net
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * Upgrade the plugin.
- *
- * @param int $oldversion
- * @return bool always true
- */
-function xmldb_tool_lp_upgrade($oldversion) {
- global $CFG, $DB, $OUTPUT;
-
- $dbman = $DB->get_manager();
-
- if ($oldversion < 2015052403) {
-
- // Define index idnumber (unique) to be added to tool_lp_competency_framework.
- $table = new xmldb_table('tool_lp_competency_framework');
- $index = new xmldb_index('idnumber', XMLDB_INDEX_UNIQUE, array('idnumber'));
-
- // Conditionally launch add index idnumber.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052403, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052404) {
-
- // Define index idnumberframework (unique) to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $index = new xmldb_index('idnumberframework', XMLDB_INDEX_UNIQUE, array('competencyframeworkid', 'idnumber'));
-
- // Conditionally launch add index idnumberframework.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052404, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052405) {
-
- // Define field contextid to be added to tool_lp_competency_framework.
- $table = new xmldb_table('tool_lp_competency_framework');
- $field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null,
- context_system::instance()->id, 'shortname');
-
- // Conditionally launch add field contextid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052405, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052406) {
-
- // Define field sortorder to be dropped from tool_lp_competency_framework.
- $table = new xmldb_table('tool_lp_competency_framework');
- $field = new xmldb_field('sortorder');
-
- // Conditionally launch drop field sortorder.
- if ($dbman->field_exists($table, $field)) {
- $dbman->drop_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052406, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052407) {
-
- // Define field contextid to be added to tool_lp_template.
- $table = new xmldb_table('tool_lp_template');
- $field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null,
- context_system::instance()->id, 'shortname');
-
- // Conditionally launch add field contextid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052407, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052408) {
-
- // Define field sortorder to be dropped from tool_lp_template.
- $table = new xmldb_table('tool_lp_template');
- $field = new xmldb_field('sortorder');
-
- // Conditionally launch drop field sortorder.
- if ($dbman->field_exists($table, $field)) {
- $dbman->drop_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052408, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052412) {
-
- // Define table tool_lp_related_competency to be created.
- $table = new xmldb_table('tool_lp_related_competency');
-
- // Adding fields to table tool_lp_related_competency.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('relatedcompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_related_competency.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Conditionally launch create table for tool_lp_related_competency.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052412, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052414) {
-
- // Define field taxonomies to be added to tool_lp_competency_framework.
- $table = new xmldb_table('tool_lp_competency_framework');
- $field = new xmldb_field('taxonomies', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'visible');
-
- // Conditionally launch add field taxonomies.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052414, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052416) {
-
- // Define field idnumber to be dropped from tool_lp_template.
- $table = new xmldb_table('tool_lp_template');
- $field = new xmldb_field('idnumber');
-
- // Conditionally launch drop field idnumber.
- if ($dbman->field_exists($table, $field)) {
- $dbman->drop_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052416, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052420) {
-
- // Define table tool_lp_user_competency to be created.
- $table = new xmldb_table('tool_lp_user_competency');
-
- // Adding fields to table tool_lp_user_competency.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, '0');
- $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_competency.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- $index = new xmldb_index('useridcompetency', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid'));
-
- // Conditionally launch create table for tool_lp_user_competency.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Conditionally launch add index useridcompetency.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052420, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052423) {
-
- // Define table tool_lp_user_competency_plan to be created.
- $table = new xmldb_table('tool_lp_user_competency_plan');
-
- // Adding fields to table tool_lp_user_competency_plan.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
- $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, '0');
- $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_competency_plan.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- $index = new xmldb_index('usercompetencyplan', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid', 'planid'));
-
- // Conditionally launch create table for tool_lp_user_competency_plan.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Conditionally launch add index useridcompetency.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052423, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052424) {
-
- // Define table tool_lp_plan_competency to be created.
- $table = new xmldb_table('tool_lp_plan_competency');
-
- // Adding fields to table tool_lp_plan_competency.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_competency.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Index for table tool_lp_plan_competency.
- $index = new xmldb_index('planidcompetencyid', XMLDB_INDEX_UNIQUE, array('planid', 'competencyid'));
-
- // Conditionally launch create table for tool_lp_plan_competency.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Conditionally launch add index planidcompetencyid.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052424, 'tool', 'lp');
- }
-
- if ($oldversion < 2015052427) {
-
- // Define fields status and reviewerid to be dropped from tool_lp_user_competency_plan.
- $table = new xmldb_table('tool_lp_user_competency_plan');
- $fieldstatus = new xmldb_field('status');
- $fieldreviewerid = new xmldb_field('reviewerid');
-
- // Conditionally launch drop field status.
- if ($dbman->field_exists($table, $fieldstatus)) {
- $dbman->drop_field($table, $fieldstatus);
- }
-
- // Conditionally launch drop field status.
- if ($dbman->field_exists($table, $fieldreviewerid)) {
- $dbman->drop_field($table, $fieldreviewerid);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015052427, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111001) {
-
- // Define field ruletype to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('ruletype', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'sortorder');
-
- // Conditionally launch add field ruletype.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111001, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111002) {
-
- // Define field ruleoutcome to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'ruletype');
-
- // Conditionally launch add field ruleoutcome.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111002, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111003) {
-
- // Define field ruleconfig to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('ruleconfig', XMLDB_TYPE_TEXT, null, null, null, null, null, 'ruleoutcome');
-
- // Conditionally launch add field ruleconfig.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111003, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111004) {
-
- // Define index ruleoutcome (not unique) to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $index = new xmldb_index('ruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('ruleoutcome'));
-
- // Conditionally launch add index ruleoutcome.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111004, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111005) {
-
- // Define table tool_lp_evidence to be created.
- $table = new xmldb_table('tool_lp_evidence');
-
- // Adding fields to table tool_lp_evidence.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('usercompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('descidentifier', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
- $table->add_field('desccomponent', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
- $table->add_field('desca', XMLDB_TYPE_TEXT, null, null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_evidence.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table tool_lp_evidence.
- $table->add_index('usercompetencyid', XMLDB_INDEX_NOTUNIQUE, array('usercompetencyid'));
-
- // Conditionally launch create table for tool_lp_evidence.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111005, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111011) {
-
- // Define index statusduedate (not unique) to be added to tool_lp_plan.
- $table = new xmldb_table('tool_lp_plan');
- $index = new xmldb_index('statusduedate', XMLDB_INDEX_NOTUNIQUE, array('status', 'duedate'));
-
- // Conditionally launch add index statusduedate.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111011, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111012) {
-
- // Define table tool_lp_template_cohort to be created.
- $table = new xmldb_table('tool_lp_template_cohort');
-
- // Adding fields to table tool_lp_template_cohort.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('cohortid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_template_cohort.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table tool_lp_template_cohort.
- $table->add_index('templateid', XMLDB_INDEX_NOTUNIQUE, array('templateid'));
- $table->add_index('templatecohortids', XMLDB_INDEX_UNIQUE, array('templateid', 'cohortid'));
-
- // Conditionally launch create table for tool_lp_template_cohort.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111012, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111013) {
-
- // Define field origtemplateid to be added to tool_lp_plan.
- $table = new xmldb_table('tool_lp_plan');
- $field = new xmldb_field('origtemplateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'templateid');
-
- // Conditionally launch add field origtemplateid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111013, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111017) {
-
- // Define field scaleid to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('scaleid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'ruleconfig');
-
- // Conditionally launch add field scaleid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111017, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111018) {
-
- // Define field scaleconfiguration to be added to tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, null, null, null, 'scaleid');
-
- // Conditionally launch add field scaleconfiguration.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111018, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111020) {
-
- // Define field url and grade to be added to tool_lp_evidence.
- $table = new xmldb_table('tool_lp_evidence');
- $fieldurl = new xmldb_field('url', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'desca');
- $fieldgrade = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'url');
-
- // Conditionally launch add field url.
- if (!$dbman->field_exists($table, $fieldurl)) {
- $dbman->add_field($table, $fieldurl);
- }
-
- // Conditionally launch add field grade.
- if (!$dbman->field_exists($table, $fieldgrade)) {
- $dbman->add_field($table, $fieldgrade);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111020, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111021) {
-
- // Define field ruleoutcome to be added to tool_lp_course_competency.
- $table = new xmldb_table('tool_lp_course_competency');
- $field = new xmldb_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, 0, 'competencyid');
- $index = new xmldb_index('courseidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'ruleoutcome'));
-
- // Conditionally launch add field ruleoutcome.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Conditionally launch add index ruleoutcome.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111021, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111022) {
-
- // Define field contextid to be added to tool_lp_evidence.
- $table = new xmldb_table('tool_lp_evidence');
- $field = new xmldb_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'usercompetencyid');
-
- // Conditionally launch add field contextid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111022, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111023) {
-
- // Define field action to be added to tool_lp_evidence.
- $table = new xmldb_table('tool_lp_evidence');
- $field = new xmldb_field('action', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null, 'contextid');
-
- // Conditionally launch add field action.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111023, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111024) {
-
- // Define field actionuserid to be added to tool_lp_evidence.
- $table = new xmldb_table('tool_lp_evidence');
- $field = new xmldb_field('actionuserid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'action');
-
- // Conditionally launch add field actionuserid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111024, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111027) {
-
- // Define table tool_lp_user_evidence to be created.
- $table = new xmldb_table('tool_lp_user_evidence');
-
- // Adding fields to table tool_lp_user_evidence.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
- $table->add_field('description', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
- $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
- $table->add_field('url', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_evidence.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table tool_lp_user_evidence.
- $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
-
- // Conditionally launch create table for tool_lp_user_evidence.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111027, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111029) {
-
- // Define table tool_lp_user_evidence_comp to be created.
- $table = new xmldb_table('tool_lp_user_evidence_comp');
-
- // Adding fields to table tool_lp_user_evidence_comp.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('userevidenceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_evidence_comp.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table tool_lp_user_evidence_comp.
- $table->add_index('userevidenceid', XMLDB_INDEX_NOTUNIQUE, array('userevidenceid'));
- $table->add_index('userevidencecompids', XMLDB_INDEX_UNIQUE, array('userevidenceid', 'competencyid'));
-
- // Conditionally launch create table for tool_lp_user_evidence_comp.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111029, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111030) {
-
- // Define field visible to be removed from tool_lp_competency.
- $table = new xmldb_table('tool_lp_competency');
- $field = new xmldb_field('visible');
-
- // Conditionally launch drop field visible.
- if ($dbman->field_exists($table, $field)) {
- $dbman->drop_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111030, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111039) {
-
- // Define table tool_lp_module_competency to be created.
- $table = new xmldb_table('tool_lp_module_competency');
-
- // Adding fields to table tool_lp_module_competency.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('cmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_module_competency.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
- $table->add_key('cmidkey', XMLDB_KEY_FOREIGN, array('cmid'), 'id', array('course_modules'));
- $table->add_key('competencyidkey', XMLDB_KEY_FOREIGN, array('competencyid'), 'tool_lp_competency', array('id'));
-
- // Adding indexes to table tool_lp_module_competency.
- $table->add_index('cmidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('cmid', 'ruleoutcome'));
-
- // Conditionally launch create table for tool_lp_module_competency.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111039, 'tool', 'lp');
- }
-
- if ($oldversion < 2015111041) {
-
- // Define field reviewerid to be added to tool_lp_plan.
- $table = new xmldb_table('tool_lp_plan');
- $field = new xmldb_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'duedate');
-
- // Conditionally launch add field reviewerid.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2015111041, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020900) {
-
- // Define field note to be added to tool_lp_evidence.
- $table = new xmldb_table('tool_lp_evidence');
- $field = new xmldb_field('note', XMLDB_TYPE_TEXT, null, null, null, null, null, 'grade');
-
- // Conditionally launch add field note.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020900, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020901) {
-
- // Define field note to be added to tool_lp_user_competency_plan.
- $table = new xmldb_table('tool_lp_user_competency_plan');
- $field = new xmldb_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
-
- // Conditionally launch add field note.
- if (!$dbman->field_exists($table, $field)) {
- $dbman->add_field($table, $field);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020901, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020902) {
-
- // Define index cmidcompetencyid to be added to tool_lp_module_competency.
- $table = new xmldb_table('tool_lp_module_competency');
- $index = new xmldb_index('cmidcompetencyid', XMLDB_INDEX_NOTUNIQUE, array('cmid', 'competencyid'));
-
- // Conditionally launch add index cmidcompetencyid.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020902, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020909) {
-
- // Define index cmidcompetencyid (unique) to be dropped form tool_lp_module_competency.
- $table = new xmldb_table('tool_lp_module_competency');
- $index = new xmldb_index('cmidcompetencyid', XMLDB_INDEX_NOTUNIQUE, array('cmid', 'competencyid'));
-
- // Conditionally launch drop index cmidcompetencyid.
- if ($dbman->index_exists($table, $index)) {
- $dbman->drop_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020909, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020910) {
-
- // Define index cmidcompetencyid (unique) to be added to tool_lp_module_competency.
- $table = new xmldb_table('tool_lp_module_competency');
- $index = new xmldb_index('cmidcompetencyid', XMLDB_INDEX_UNIQUE, array('cmid', 'competencyid'));
-
- // Conditionally launch add index cmidcompetencyid.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020910, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020912) {
-
- // Define table tool_lp_user_comp_course to be created.
- $table = new xmldb_table('tool_lp_user_comp_course');
-
- // Adding fields to table tool_lp_user_comp_course.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
- $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
-
- // Adding keys to table tool_lp_user_comp_course.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-
- // Adding indexes to table tool_lp_user_comp_course.
- $table->add_index('useridcoursecomp', XMLDB_INDEX_UNIQUE, array('userid', 'courseid', 'competencyid'));
-
- // Conditionally launch create table for tool_lp_user_comp_course.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020912, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020913) {
-
- // Changing type of field scaleconfiguration on table tool_lp_competency_framework to text.
- $table = new xmldb_table('tool_lp_competency_framework');
- $field = new xmldb_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'scaleid');
-
- // Launch change of type for field scaleconfiguration.
- $dbman->change_field_type($table, $field);
-
- // Launch change of nullability for field scaleconfiguration.
- $dbman->change_field_notnull($table, $field);
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020913, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020917) {
- // Define index courseidcompetencyid (unique) to be added to tool_lp_course_competency.
- $table = new xmldb_table('tool_lp_course_competency');
- $index = new xmldb_index('courseidcompetencyid', XMLDB_INDEX_UNIQUE, array('courseid', 'competencyid'));
- // Conditionally launch add index cmidcompetencyid.
- if (!$dbman->index_exists($table, $index)) {
- $dbman->add_index($table, $index);
- }
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020917, 'tool', 'lp');
- }
-
- if ($oldversion < 2016020923) {
-
- // Define table tool_lp_coursecompsettings to be created.
- $table = new xmldb_table('tool_lp_coursecompsettings');
-
- // Adding fields to table tool_lp_coursecompsettings.
- $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
- $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('pushratingstouserplans', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
- $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
- $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
-
- // Adding keys to table tool_lp_coursecompsettings.
- $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
- $table->add_key('courseidlink', XMLDB_KEY_FOREIGN_UNIQUE, array('courseid'), 'course', array('id'));
-
- // Conditionally launch create table for tool_lp_coursecompsettings.
- if (!$dbman->table_exists($table)) {
- $dbman->create_table($table);
- }
-
- // Lp savepoint reached.
- upgrade_plugin_savepoint(true, 2016020923, 'tool', 'lp');
- }
-
-
- return true;
-}
diff --git a/admin/tool/lp/tests/api_test.php b/admin/tool/lp/tests/api_test.php
index ececae8d8fd..7731b2d50ee 100644
--- a/admin/tool/lp/tests/api_test.php
+++ b/admin/tool/lp/tests/api_test.php
@@ -3983,7 +3983,7 @@ class tool_lp_api_testcase extends advanced_testcase {
$currenttime += 1;
$p2->set_status(plan::STATUS_COMPLETE);
$p2->update();
- $plansql = "UPDATE {tool_lp_plan} SET timemodified = :currenttime WHERE id = :planid";
+ $plansql = "UPDATE {" . plan::TABLE . "} SET timemodified = :currenttime WHERE id = :planid";
$DB->execute($plansql, array('currenttime' => $currenttime, 'planid' => $p2->get_id()));
// Add an other user evidence for the same competency.
@@ -3991,7 +3991,7 @@ class tool_lp_api_testcase extends advanced_testcase {
$ue2 = $lpg->create_user_evidence(array('userid' => $user->id));
$uec2 = $lpg->create_user_evidence_competency(array('userevidenceid' => $ue2->get_id(), 'competencyid' => $c1->get_id()));
$e2 = $lpg->create_evidence(array('usercompetencyid' => $uc->get_id()));
- $evidencesql = "UPDATE {tool_lp_evidence} SET timecreated = :currenttime WHERE id = :evidenceid";
+ $evidencesql = "UPDATE {" . evidence::TABLE . "} SET timecreated = :currenttime WHERE id = :evidenceid";
$DB->execute($evidencesql, array('currenttime' => $currenttime, 'evidenceid' => $e2->get_id()));
// Check first plan which is not completed as all evidences.
diff --git a/admin/tool/lp/tests/externallib_test.php b/admin/tool/lp/tests/externallib_test.php
index a5dc704f717..09e3db1f166 100644
--- a/admin/tool/lp/tests/externallib_test.php
+++ b/admin/tool/lp/tests/externallib_test.php
@@ -34,6 +34,7 @@ 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;
@@ -2007,9 +2008,9 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$sys1 = $this->create_template(1, true);
$cat1 = $this->create_template(2, false);
$cat2 = $this->create_template(3, false);
- $this->assertTrue($DB->record_exists('tool_lp_template', array('id' => $sys1->id)));
- $this->assertTrue($DB->record_exists('tool_lp_template', array('id' => $cat1->id)));
- $this->assertTrue($DB->record_exists('tool_lp_template', array('id' => $cat2->id)));
+ $this->assertTrue($DB->record_exists(template::TABLE, array('id' => $sys1->id)));
+ $this->assertTrue($DB->record_exists(template::TABLE, array('id' => $cat1->id)));
+ $this->assertTrue($DB->record_exists(template::TABLE, array('id' => $cat2->id)));
// User without permissions.
$this->setUser($this->user);
@@ -2038,7 +2039,7 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$result = external::delete_template($cat1->id);
$result = external_api::clean_returnvalue(external::delete_template_returns(), $result);
$this->assertTrue($result);
- $this->assertFalse($DB->record_exists('tool_lp_template', array('id' => $cat1->id)));
+ $this->assertFalse($DB->record_exists(template::TABLE, array('id' => $cat1->id)));
// User with system permissions.
$this->setUser($this->creator);
@@ -2048,8 +2049,8 @@ class tool_lp_external_testcase extends externallib_advanced_testcase {
$result = external::delete_template($cat2->id);
$result = external_api::clean_returnvalue(external::delete_template_returns(), $result);
$this->assertTrue($result);
- $this->assertFalse($DB->record_exists('tool_lp_template', array('id' => $sys1->id)));
- $this->assertFalse($DB->record_exists('tool_lp_template', array('id' => $cat2->id)));
+ $this->assertFalse($DB->record_exists(template::TABLE, array('id' => $sys1->id)));
+ $this->assertFalse($DB->record_exists(template::TABLE, array('id' => $cat2->id)));
}
/**
diff --git a/admin/tool/lp/tests/persistent_test.php b/admin/tool/lp/tests/persistent_test.php
index 37f4bd7f1d2..cb444ee5d8e 100644
--- a/admin/tool/lp/tests/persistent_test.php
+++ b/admin/tool/lp/tests/persistent_test.php
@@ -403,7 +403,7 @@ class tool_lp_persistent_testcase extends advanced_testcase {
*/
class tool_lp_testable_persistent extends \tool_lp\persistent {
- const TABLE = 'tool_lp_competency';
+ const TABLE = 'competency';
protected static function define_properties() {
return array(
diff --git a/admin/tool/lp/tests/task_test.php b/admin/tool/lp/tests/task_test.php
index 0a04e9b45be..f32abe53f31 100644
--- a/admin/tool/lp/tests/task_test.php
+++ b/admin/tool/lp/tests/task_test.php
@@ -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} SET timemodified = :currenttime WHERE id = :templateid";
- $plansql = "UPDATE {tool_lp_plan} SET timemodified = :currenttime WHERE id = :planid";
+ $tplsql = "UPDATE {" . \tool_lp\template::TABLE . "} SET timemodified = :currenttime WHERE id = :templateid";
+ $plansql = "UPDATE {" . \tool_lp\plan::TABLE . "} SET timemodified = :currenttime WHERE id = :planid";
$currenttime = time();
diff --git a/lib/db/install.xml b/lib/db/install.xml
index ff92a464eaa..47fc98a0049 100644
--- a/lib/db/install.xml
+++ b/lib/db/install.xml
@@ -1,5 +1,5 @@
-
@@ -3102,5 +3102,336 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index fc8ba43a926..072b3db812f 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -1464,5 +1464,540 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2016030400.01);
}
+ if ($oldversion < 2016041500.50) {
+
+ // Define table competency to be created.
+ $table = new xmldb_table('competency');
+
+ // Adding fields to table competency.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('competencyframeworkid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('parentid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('path', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('ruletype', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('ruleconfig', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('scaleid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+
+ // Adding keys to table competency.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency.
+ $table->add_index('idnumberframework', XMLDB_INDEX_UNIQUE, array('competencyframeworkid', 'idnumber'));
+ $table->add_index('ruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('ruleoutcome'));
+
+ // Conditionally launch create table for competency.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.50);
+ }
+
+ if ($oldversion < 2016041500.51) {
+
+ // Define table competency_coursecompsetting to be created.
+ $table = new xmldb_table('competency_coursecompsetting');
+
+ // Adding fields to table competency_coursecompsetting.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('pushratingstouserplans', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+
+ // Adding keys to table competency_coursecompsetting.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('courseidlink', XMLDB_KEY_FOREIGN_UNIQUE, array('courseid'), 'course', array('id'));
+
+ // Conditionally launch create table for competency_coursecompsetting.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.51);
+ }
+
+ if ($oldversion < 2016041500.52) {
+
+ // Define table competency_framework to be created.
+ $table = new xmldb_table('competency_framework');
+
+ // Adding fields to table competency_framework.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('scaleid', XMLDB_TYPE_INTEGER, '11', null, null, null, null);
+ $table->add_field('scaleconfiguration', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
+ $table->add_field('visible', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
+ $table->add_field('taxonomies', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+
+ // Adding keys to table competency_framework.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_framework.
+ $table->add_index('idnumber', XMLDB_INDEX_UNIQUE, array('idnumber'));
+
+ // Conditionally launch create table for competency_framework.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.52);
+ }
+
+ if ($oldversion < 2016041500.53) {
+
+ // Define table competency_coursecomp to be created.
+ $table = new xmldb_table('competency_coursecomp');
+
+ // Adding fields to table competency_coursecomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_coursecomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('courseidlink', XMLDB_KEY_FOREIGN, array('courseid'), 'course', array('id'));
+ $table->add_key('competencyid', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
+
+ // Adding indexes to table competency_coursecomp.
+ $table->add_index('courseidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'ruleoutcome'));
+ $table->add_index('courseidcompetencyid', XMLDB_INDEX_UNIQUE, array('courseid', 'competencyid'));
+
+ // Conditionally launch create table for competency_coursecomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.53);
+ }
+
+ if ($oldversion < 2016041500.54) {
+
+ // Define table competency_plan to be created.
+ $table = new xmldb_table('competency_plan');
+
+ // Adding fields to table competency_plan.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('origtemplateid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('status', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
+ $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_plan.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_plan.
+ $table->add_index('useridstatus', XMLDB_INDEX_NOTUNIQUE, array('userid', 'status'));
+ $table->add_index('templateid', XMLDB_INDEX_NOTUNIQUE, array('templateid'));
+ $table->add_index('statusduedate', XMLDB_INDEX_NOTUNIQUE, array('status', 'duedate'));
+
+ // Conditionally launch create table for competency_plan.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.54);
+ }
+
+ if ($oldversion < 2016041500.55) {
+
+ // Define table competency_template to be created.
+ $table = new xmldb_table('competency_template');
+
+ // Adding fields to table competency_template.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('shortname', XMLDB_TYPE_CHAR, '100', null, null, null, null);
+ $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('visible', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
+ $table->add_field('duedate', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+
+ // Adding keys to table competency_template.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Conditionally launch create table for competency_template.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.55);
+ }
+
+ if ($oldversion < 2016041500.56) {
+
+ // Define table competency_templatecomp to be created.
+ $table = new xmldb_table('competency_templatecomp');
+
+ // Adding fields to table competency_templatecomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+
+ // Adding keys to table competency_templatecomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('templateidlink', XMLDB_KEY_FOREIGN, array('templateid'), 'competency_template', array('id'));
+ $table->add_key('competencyid', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
+
+ // Conditionally launch create table for competency_templatecomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.56);
+ }
+
+ if ($oldversion < 2016041500.57) {
+
+ // Define table competency_templatecohort to be created.
+ $table = new xmldb_table('competency_templatecohort');
+
+ // Adding fields to table competency_templatecohort.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('templateid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('cohortid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_templatecohort.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_templatecohort.
+ $table->add_index('templateid', XMLDB_INDEX_NOTUNIQUE, array('templateid'));
+ $table->add_index('templatecohortids', XMLDB_INDEX_UNIQUE, array('templateid', 'cohortid'));
+
+ // Conditionally launch create table for competency_templatecohort.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.57);
+ }
+
+ if ($oldversion < 2016041500.58) {
+
+ // Define table competency_relatedcomp to be created.
+ $table = new xmldb_table('competency_relatedcomp');
+
+ // Adding fields to table competency_relatedcomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('relatedcompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_relatedcomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Conditionally launch create table for competency_relatedcomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.58);
+ }
+
+ if ($oldversion < 2016041500.59) {
+
+ // Define table competency_usercomp to be created.
+ $table = new xmldb_table('competency_usercomp');
+
+ // Adding fields to table competency_usercomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('status', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
+ $table->add_field('reviewerid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
+ $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_usercomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_usercomp.
+ $table->add_index('useridcompetency', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid'));
+
+ // Conditionally launch create table for competency_usercomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.59);
+ }
+
+ if ($oldversion < 2016041500.60) {
+
+ // Define table competency_usercompcourse to be created.
+ $table = new xmldb_table('competency_usercompcourse');
+
+ // Adding fields to table competency_usercompcourse.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
+ $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_usercompcourse.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_usercompcourse.
+ $table->add_index('useridcoursecomp', XMLDB_INDEX_UNIQUE, array('userid', 'courseid', 'competencyid'));
+
+ // Conditionally launch create table for competency_usercompcourse.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.60);
+ }
+
+ if ($oldversion < 2016041500.61) {
+
+ // Define table competency_usercompplan to be created.
+ $table = new xmldb_table('competency_usercompplan');
+
+ // Adding fields to table competency_usercompplan.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('proficiency', XMLDB_TYPE_INTEGER, '2', null, null, null, null);
+ $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_usercompplan.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_usercompplan.
+ $table->add_index('usercompetencyplan', XMLDB_INDEX_UNIQUE, array('userid', 'competencyid', 'planid'));
+
+ // Conditionally launch create table for competency_usercompplan.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.61);
+ }
+
+ if ($oldversion < 2016041500.62) {
+
+ // Define table competency_plancomp to be created.
+ $table = new xmldb_table('competency_plancomp');
+
+ // Adding fields to table competency_plancomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('planid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_plancomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_plancomp.
+ $table->add_index('planidcompetencyid', XMLDB_INDEX_UNIQUE, array('planid', 'competencyid'));
+
+ // Conditionally launch create table for competency_plancomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.62);
+ }
+
+ if ($oldversion < 2016041500.63) {
+
+ // Define table competency_evidence to be created.
+ $table = new xmldb_table('competency_evidence');
+
+ // Adding fields to table competency_evidence.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('usercompetencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('action', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('actionuserid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('descidentifier', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('desccomponent', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('desca', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('url', XMLDB_TYPE_CHAR, '255', null, null, null, null);
+ $table->add_field('grade', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
+ $table->add_field('note', XMLDB_TYPE_TEXT, null, null, null, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_evidence.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_evidence.
+ $table->add_index('usercompetencyid', XMLDB_INDEX_NOTUNIQUE, array('usercompetencyid'));
+
+ // Conditionally launch create table for competency_evidence.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.63);
+ }
+
+ if ($oldversion < 2016041500.64) {
+
+ // Define table competency_userevidence to be created.
+ $table = new xmldb_table('competency_userevidence');
+
+ // Adding fields to table competency_userevidence.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('name', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('description', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
+ $table->add_field('descriptionformat', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('url', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_userevidence.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_userevidence.
+ $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
+
+ // Conditionally launch create table for competency_userevidence.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.64);
+ }
+
+ if ($oldversion < 2016041500.65) {
+
+ // Define table competency_userevidencecomp to be created.
+ $table = new xmldb_table('competency_userevidencecomp');
+
+ // Adding fields to table competency_userevidencecomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('userevidenceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_userevidencecomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+
+ // Adding indexes to table competency_userevidencecomp.
+ $table->add_index('userevidenceid', XMLDB_INDEX_NOTUNIQUE, array('userevidenceid'));
+ $table->add_index('userevidencecompids', XMLDB_INDEX_UNIQUE, array('userevidenceid', 'competencyid'));
+
+ // Conditionally launch create table for competency_userevidencecomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.65);
+ }
+
+ if ($oldversion < 2016041500.66) {
+
+ // Define table competency_modulecomp to be created.
+ $table = new xmldb_table('competency_modulecomp');
+
+ // Adding fields to table competency_modulecomp.
+ $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
+ $table->add_field('cmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('usermodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('competencyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
+ $table->add_field('ruleoutcome', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, null);
+
+ // Adding keys to table competency_modulecomp.
+ $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
+ $table->add_key('cmidkey', XMLDB_KEY_FOREIGN, array('cmid'), 'course_modules', array('id'));
+ $table->add_key('competencyidkey', XMLDB_KEY_FOREIGN, array('competencyid'), 'competency_competency', array('id'));
+
+ // Adding indexes to table competency_modulecomp.
+ $table->add_index('cmidruleoutcome', XMLDB_INDEX_NOTUNIQUE, array('cmid', 'ruleoutcome'));
+ $table->add_index('cmidcompetencyid', XMLDB_INDEX_UNIQUE, array('cmid', 'competencyid'));
+
+ // Conditionally launch create table for competency_modulecomp.
+ if (!$dbman->table_exists($table)) {
+ $dbman->create_table($table);
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2016041500.66);
+ }
+
return true;
}
diff --git a/version.php b/version.php
index a7bbdee35bb..2bcf7ee8e1c 100644
--- a/version.php
+++ b/version.php
@@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2016041500.00; // YYYYMMDD = weekly release date of this DEV branch.
+$version = 2016041500.66; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.