MDL-49460 tool_lp: Adding user learning plans

Basic CRUD skeleton with external functions.
This commit is contained in:
David Monllao 2015-05-18 10:26:37 +08:00 committed by Frederic Massart
parent d9a39950b2
commit 4db373d5cb
21 changed files with 1653 additions and 27 deletions

View file

@ -58,21 +58,43 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:learningplanread' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:learningplanmanage' => array(
'tool/lp:plancreatedraft' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planmanage' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planmanageown' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planviewall' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
),
'clonepermissionsfrom' => 'moodle/site:config'
),
'tool/lp:planviewown' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
'archetypes' => array(
'user' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/block:view'
),
'tool/lp:coursecompetencyread' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
@ -90,5 +112,4 @@ $capabilities = array(
),
'clonepermissionsfrom' => 'moodle/site:backup'
)
);

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="admin/tool/lp/db" VERSION="20150312" COMMENT="XMLDB file for Moodle admin/tool/lp"
<XMLDB PATH="admin/tool/lp/db" VERSION="20150515" COMMENT="XMLDB file for Moodle admin/tool/lp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
>
@ -91,5 +91,27 @@
<KEY NAME="competencyid" TYPE="foreign" FIELDS="competencyid" REFTABLE="tool_lp_competency" REFFIELDS="id" COMMENT="Competency foreign key."/>
</KEYS>
</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="status" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="duedate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" 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"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>

View file

@ -308,6 +308,53 @@ $functions = array(
'type' => 'write',
'capabilities'=> 'tool/lp:templatemanage',
),
'tool_lp_create_plan' => array(
'classname' => 'tool_lp\external',
'methodname' => 'create_plan',
'classpath' => '',
'description' => 'Creates a learning plan.',
'type' => 'write',
'capabilities'=> 'tool/lp:planmanage',
),
'tool_lp_update_plan' => array(
'classname' => 'tool_lp\external',
'methodname' => 'update_plan',
'classpath' => '',
'description' => 'Updates a learning plan.',
'type' => 'write',
'capabilities'=> 'tool/lp:planmanage',
),
'tool_lp_read_plan' => array(
'classname' => 'tool_lp\external',
'methodname' => 'read_plan',
'classpath' => '',
'description' => 'Load a learning plan.',
'type' => 'read',
'capabilities'=> 'tool/lp:planviewown',
),
'tool_lp_read_plan' => array(
'classname' => 'tool_lp\external',
'methodname' => 'read_plan',
'classpath' => '',
'description' => 'Load a learning plan.',
'type' => 'read',
'capabilities'=> 'tool/lp:planviewown',
),
'tool_lp_delete_plan' => array(
'classname' => 'tool_lp\external',
'methodname' => 'delete_plan',
'classpath' => '',
'description' => 'Delete a learning plan.',
'type' => 'write',
'capabilities'=> 'tool/lp:planmanage',
),
'tool_lp_data_for_plans_page' => array(
'classname' => 'tool_lp\external',
'methodname' => 'data_for_plans_page',
'classpath' => '',
'description' => 'Load the data for the plans page template',
'type' => 'read',
'capabilities'=> 'tool/lp:planviewown',
)
);