mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-52534 tool_lp: Competencies can be attached to activities
This commit is contained in:
parent
8995c2702f
commit
db65073748
21 changed files with 1361 additions and 9 deletions
|
@ -30,4 +30,8 @@ $observers = array(
|
|||
'eventname' => '\\core\\event\\course_completed',
|
||||
'callback' => '\\tool_lp\\api::observe_course_completed',
|
||||
),
|
||||
array(
|
||||
'eventname' => '\\core\\event\\course_module_completion_updated',
|
||||
'callback' => '\\tool_lp\\api::observe_course_module_completion_updated',
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/tool/lp/db" VERSION="20160104" COMMENT="XMLDB file for Moodle admin/tool/lp"
|
||||
<XMLDB PATH="admin/tool/lp/db" VERSION="20160114" COMMENT="XMLDB file for Moodle admin/tool/lp"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
|
@ -278,5 +278,25 @@
|
|||
<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="id" REFFIELDS="course_modules" 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."/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
|
|
@ -651,6 +651,38 @@ function xmldb_tool_lp_upgrade($oldversion) {
|
|||
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.
|
||||
|
@ -666,6 +698,5 @@ function xmldb_tool_lp_upgrade($oldversion) {
|
|||
upgrade_plugin_savepoint(true, 2015111041, 'tool', 'lp');
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue