MDL-53700 competency: Migrate database tables to core

This commit is contained in:
Frederic Massart
2016-04-18 11:05:58 +08:00
parent b90e2205b4
commit a4e659c788
26 changed files with 898 additions and 1233 deletions
+1 -1
View File
@@ -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;
@@ -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';
+1 -1
View File
@@ -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;
@@ -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.
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
@@ -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.
+1 -1
View File
@@ -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;
@@ -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.
@@ -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.
+1 -1
View File
@@ -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.
@@ -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.
-339
View File
@@ -1,339 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="admin/tool/lp/db" VERSION="20160329" COMMENT="XMLDB file for Moodle admin/tool/lp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="tool_lp_competency" COMMENT="This table contains the master record of each competency in a framework.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Shortname of a competency"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of a single competency"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="competencyframeworkid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The framework this competency relates to."/>
<FIELD NAME="parentid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The parent competency."/>
<FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Used to speed up queries that use an entire branch of the tree. Looks like /5/34/54."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Relative sort order within the branch"/>
<FIELD NAME="ruletype" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="ruleconfig" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="scaleconfiguration" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this competency"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="idnumberframework" UNIQUE="true" FIELDS="competencyframeworkid, idnumber"/>
<INDEX NAME="ruleoutcome" UNIQUE="false" FIELDS="ruleoutcome"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_coursecompsettings" COMMENT="This table contains the course specific settings for competencies.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this setting is linked to."/>
<FIELD NAME="pushratingstouserplans" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Does this course push ratings to user plans?"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this setting was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this setting was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this setting"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseidlink" TYPE="foreign-unique" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
</KEYS>
</TABLE>
<TABLE NAME="tool_lp_competency_framework" COMMENT="List of competency frameworks.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Short name for the competency framework."/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Unique idnumber for this competency framework."/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of this competency framework"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="scaleid" TYPE="int" LENGTH="11" NOTNULL="false" SEQUENCE="false" COMMENT="Scale used to define competency."/>
<FIELD NAME="scaleconfiguration" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Scale information."/>
<FIELD NAME="visible" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Used to show/hide this competency framework."/>
<FIELD NAME="taxonomies" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Sequence of terms to use for each competency level."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency framework was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency framework was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this framework"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="idnumber" UNIQUE="true" FIELDS="idnumber"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_course_competency" COMMENT="Link a competency to a course.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The competency that is linked to this course."/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false" COMMENT="The rule that applies to the competency when the course is completed."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who modified this link."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The display order for this link."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseidlink" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
<KEY NAME="competencyid" TYPE="foreign" FIELDS="competencyid" REFTABLE="tool_lp_competency" REFFIELDS="id" COMMENT="Competency foreign key."/>
</KEYS>
<INDEXES>
<INDEX NAME="courseidruleoutcome" UNIQUE="false" FIELDS="courseid, ruleoutcome"/>
<INDEX NAME="courseidcompetencyid" UNIQUE="true" FIELDS="courseid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_plan" COMMENT="Learning plans">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="origtemplateid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The template ID this plan was based on originally"/>
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="reviewerid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridstatus" UNIQUE="false" FIELDS="userid, status"/>
<INDEX NAME="templateid" UNIQUE="false" FIELDS="templateid"/>
<INDEX NAME="statusduedate" UNIQUE="false" FIELDS="status, duedate"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_template" COMMENT="Learning plan templates.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Short name for the learning plan template."/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of this learning plan template"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="visible" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Used to show/hide this learning plan template."/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The default due date for instances of this plan."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this learning plan template was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this learning plan template was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this learning plan template"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="tool_lp_template_competency" COMMENT="Link a competency to a learning plan template.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The template this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The competency that is linked to this course."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who modified this link."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="templateidlink" TYPE="foreign" FIELDS="templateid" REFTABLE="tool_lp_template" REFFIELDS="id" COMMENT="Template foreign key."/>
<KEY NAME="competencyid" TYPE="foreign" FIELDS="competencyid" REFTABLE="tool_lp_competency" REFFIELDS="id" COMMENT="Competency foreign key."/>
</KEYS>
</TABLE>
<TABLE NAME="tool_lp_template_cohort" COMMENT="Default comment for the table, please edit me">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="cohortid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="templateid" UNIQUE="false" FIELDS="templateid"/>
<INDEX NAME="templatecohortids" UNIQUE="true" FIELDS="templateid, cohortid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_related_competency" COMMENT="Related competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="relatedcompetencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="tool_lp_user_competency" COMMENT="User competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="status" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Competency status."/>
<FIELD NAME="reviewerid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="User that reviewed the competency."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Grade assigned to the competency."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridcompetency" UNIQUE="true" FIELDS="userid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_user_comp_course" COMMENT="User competencies in a course">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The course grade assigned for the competency."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridcoursecomp" UNIQUE="true" FIELDS="userid, courseid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_user_competency_plan" COMMENT="User competencies plans">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="planid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Plan associated to the user."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Grade assigned to the competency."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="usercompetencyplan" UNIQUE="true" FIELDS="userid, competencyid, planid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_plan_competency" COMMENT="Plan competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="planid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="planidcompetencyid" UNIQUE="true" FIELDS="planid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_evidence" COMMENT="The evidence linked to a user competency">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="usercompetencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="action" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="actionuserid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="descidentifier" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="desccomponent" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="desca" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="note" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="A non-localised text to attach to the evidence."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="usercompetencyid" UNIQUE="false" FIELDS="usercompetencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_user_evidence" COMMENT="The evidence of prior learning">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="url" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_user_evidence_comp" COMMENT="Relationship between user evidence and competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userevidenceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userevidenceid" UNIQUE="false" FIELDS="userevidenceid"/>
<INDEX NAME="userevidencecompids" UNIQUE="true" FIELDS="userevidenceid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_lp_module_competency" COMMENT="Link a competency to a module.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of the record in the course_modules table."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was last modified"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who last modified this field."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The field used to naturally sort this link."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course competency this activity is linked to."/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false" COMMENT="The outcome when an activity is completed."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="cmidkey" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id" COMMENT="Foreign key on course modules table."/>
<KEY NAME="competencyidkey" TYPE="foreign" FIELDS="competencyid" REFTABLE="tool_lp_competency" REFFIELDS="id" COMMENT="Foreign key on competency id."/>
</KEYS>
<INDEXES>
<INDEX NAME="cmidruleoutcome" UNIQUE="false" FIELDS="cmid, ruleoutcome" COMMENT="Index on cmid and outcome so we can quickly find what to do when an activity is completed."/>
<INDEX NAME="cmidcompetencyid" UNIQUE="true" FIELDS="cmid, competencyid"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
-863
View File
@@ -1,863 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* 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;
}
+2 -2
View File
@@ -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.
+7 -6
View File
@@ -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)));
}
/**
+1 -1
View File
@@ -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(
+2 -2
View File
@@ -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();
+333 -2
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="lib/db" VERSION="20160202" COMMENT="XMLDB file for core Moodle tables"
<XMLDB PATH="lib/db" VERSION="20160404" COMMENT="XMLDB file for core Moodle tables"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
>
@@ -3102,5 +3102,336 @@
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="competency" COMMENT="This table contains the master record of each competency in a framework">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Shortname of a competency"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of a single competency"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="competencyframeworkid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The framework this competency relates to."/>
<FIELD NAME="parentid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The parent competency."/>
<FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Used to speed up queries that use an entire branch of the tree. Looks like /5/34/54."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Relative sort order within the branch"/>
<FIELD NAME="ruletype" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="ruleconfig" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="scaleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="scaleconfiguration" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this competency"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="idnumberframework" UNIQUE="true" FIELDS="competencyframeworkid, idnumber"/>
<INDEX NAME="ruleoutcome" UNIQUE="false" FIELDS="ruleoutcome"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_coursecompsetting" COMMENT="This table contains the course specific settings for competencies.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this setting is linked to."/>
<FIELD NAME="pushratingstouserplans" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Does this course push ratings to user plans?"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this setting was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this setting was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this setting"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseidlink" TYPE="foreign-unique" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
</KEYS>
</TABLE>
<TABLE NAME="competency_framework" COMMENT="List of competency frameworks.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Short name for the competency framework."/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Unique idnumber for this competency framework."/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of this competency framework"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="scaleid" TYPE="int" LENGTH="11" NOTNULL="false" SEQUENCE="false" COMMENT="Scale used to define competency."/>
<FIELD NAME="scaleconfiguration" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Scale information."/>
<FIELD NAME="visible" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Used to show/hide this competency framework."/>
<FIELD NAME="taxonomies" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Sequence of terms to use for each competency level."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency framework was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this competency framework was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this framework"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="idnumber" UNIQUE="true" FIELDS="idnumber"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_coursecomp" COMMENT="Link a competency to a course.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The competency that is linked to this course."/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false" COMMENT="The rule that applies to the competency when the course is completed."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who modified this link."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The display order for this link."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="courseidlink" TYPE="foreign" FIELDS="courseid" REFTABLE="course" REFFIELDS="id" COMMENT="Course foreign key."/>
<KEY NAME="competencyid" TYPE="foreign" FIELDS="competencyid" REFTABLE="competency_competency" REFFIELDS="id" COMMENT="Competency foreign key."/>
</KEYS>
<INDEXES>
<INDEX NAME="courseidruleoutcome" UNIQUE="false" FIELDS="courseid, ruleoutcome"/>
<INDEX NAME="courseidcompetencyid" UNIQUE="true" FIELDS="courseid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_plan" COMMENT="Learning plans">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="origtemplateid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The template ID this plan was based on originally"/>
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="reviewerid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridstatus" UNIQUE="false" FIELDS="userid, status"/>
<INDEX NAME="templateid" UNIQUE="false" FIELDS="templateid"/>
<INDEX NAME="statusduedate" UNIQUE="false" FIELDS="status, duedate"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_template" COMMENT="Learning plan templates.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" COMMENT="Short name for the learning plan template."/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of this learning plan template"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The format of the description field"/>
<FIELD NAME="visible" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Used to show/hide this learning plan template."/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The default due date for instances of this plan."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this learning plan template was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this learning plan template was last modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The user who last modified this learning plan template"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="competency_templatecomp" COMMENT="Link a competency to a learning plan template.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The template this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The competency that is linked to this course."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this link was modified."/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who modified this link."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="templateidlink" TYPE="foreign" FIELDS="templateid" REFTABLE="competency_template" REFFIELDS="id" COMMENT="Template foreign key."/>
<KEY NAME="competencyid" TYPE="foreign" FIELDS="competencyid" REFTABLE="competency_competency" REFFIELDS="id" COMMENT="Competency foreign key."/>
</KEYS>
</TABLE>
<TABLE NAME="competency_templatecohort" COMMENT="Default comment for the table, please edit me">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="templateid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="cohortid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="templateid" UNIQUE="false" FIELDS="templateid"/>
<INDEX NAME="templatecohortids" UNIQUE="true" FIELDS="templateid, cohortid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_relatedcomp" COMMENT="Related competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="relatedcompetencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="competency_usercomp" COMMENT="User competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="status" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Competency status."/>
<FIELD NAME="reviewerid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="User that reviewed the competency."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Grade assigned to the competency."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridcompetency" UNIQUE="true" FIELDS="userid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_usercompcourse" COMMENT="User competencies in a course">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course this competency is linked to."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The course grade assigned for the competency."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="useridcoursecomp" UNIQUE="true" FIELDS="userid, courseid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_usercompplan" COMMENT="User competencies plans">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User associated to the competency."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Competency associated to the user."/>
<FIELD NAME="planid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Plan associated to the user."/>
<FIELD NAME="proficiency" TYPE="int" LENGTH="2" NOTNULL="false" SEQUENCE="false" COMMENT="Indicate if the competency is proficient not."/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Grade assigned to the competency."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="usercompetencyplan" UNIQUE="true" FIELDS="userid, competencyid, planid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_plancomp" COMMENT="Plan competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="planid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Relative sort order"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="planidcompetencyid" UNIQUE="true" FIELDS="planid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_evidence" COMMENT="The evidence linked to a user competency">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="usercompetencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="action" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="actionuserid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="descidentifier" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="desccomponent" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="desca" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="note" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="A non-localised text to attach to the evidence."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="usercompetencyid" UNIQUE="false" FIELDS="usercompetencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_userevidence" COMMENT="The evidence of prior learning">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="description" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="url" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_userevidencecomp" COMMENT="Relationship between user evidence and competencies">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="userevidenceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userevidenceid" UNIQUE="false" FIELDS="userevidenceid"/>
<INDEX NAME="userevidencecompids" UNIQUE="true" FIELDS="userevidenceid, competencyid"/>
</INDEXES>
</TABLE>
<TABLE NAME="competency_modulecomp" COMMENT="Link a competency to a module.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of the record in the course_modules table."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was created."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was last modified"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user who last modified this field."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The field used to naturally sort this link."/>
<FIELD NAME="competencyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The course competency this activity is linked to."/>
<FIELD NAME="ruleoutcome" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false" COMMENT="The outcome when an activity is completed."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="cmidkey" TYPE="foreign" FIELDS="cmid" REFTABLE="course_modules" REFFIELDS="id" COMMENT="Foreign key on course modules table."/>
<KEY NAME="competencyidkey" TYPE="foreign" FIELDS="competencyid" REFTABLE="competency_competency" REFFIELDS="id" COMMENT="Foreign key on competency id."/>
</KEYS>
<INDEXES>
<INDEX NAME="cmidruleoutcome" UNIQUE="false" FIELDS="cmid, ruleoutcome" COMMENT="Index on cmid and outcome so we can quickly find what to do when an activity is completed."/>
<INDEX NAME="cmidcompetencyid" UNIQUE="true" FIELDS="cmid, competencyid"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
+535
View File
@@ -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;
}
+1 -1
View File
@@ -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.