MDL-53700 competency: Migrate main classes to core

This commit is contained in:
Frederic Massart 2016-04-04 18:36:07 +08:00
parent 36a43db821
commit 67bc0eaf38
152 changed files with 768 additions and 724 deletions

View File

@ -1 +1 @@
define(["jquery","core/str","tool_lp/competency_rule"],function(a,b,c){var d=function(){c.apply(this,arguments)};return d.prototype=Object.create(c.prototype),d.prototype.getType=function(){return"tool_lp\\competency_rule_all"},d.prototype.isValid=function(){return!0},d});
define(["jquery","core/str","tool_lp/competency_rule"],function(a,b,c){var d=function(){c.apply(this,arguments)};return d.prototype=Object.create(c.prototype),d.prototype.getType=function(){return"core_competency\\competency_rule_all"},d.prototype.isValid=function(){return!0},d});

View File

@ -1 +1 @@
define(["jquery","core/str","core/templates","tool_lp/competency_rule"],function(a,b,c,d){var e=function(){d.apply(this,arguments)};return e.prototype=Object.create(d.prototype),e.prototype._container=null,e.prototype._templateLoaded=!1,e.prototype.getConfig=function(){return JSON.stringify({base:{points:this._getRequiredPoints()},competencies:this._getCompetenciesConfig()})},e.prototype._getCompetenciesConfig=function(){var b=[];return this._container.find("[data-competency]").each(function(){var c=a(this),d=c.data("competency"),e=parseInt(c.find('[name="points"]').val(),10),f=c.find('[name="required"]').prop("checked");b.push({id:d,points:e,required:f?1:0})}),b},e.prototype._getRequiredPoints=function(){return parseInt(this._container.find('[name="requiredpoints"]').val()||1,10)},e.prototype.getType=function(){return"tool_lp\\competency_rule_points"},e.prototype.injectTemplate=function(b){var d,e=this,f=this._tree.getChildren(this._competency.id),g={base:{points:2},competencies:[]};if(this._templateLoaded=!1,e._competency.ruletype==e.getType())try{g=JSON.parse(e._competency.ruleconfig)}catch(h){}return d={requiredpoints:g&&g.base?g.base.points:2,competency:e._competency,children:[]},a.each(f,function(b,c){var e={id:c.id,shortname:c.shortname,required:!1,points:0};g&&a.each(g.competencies,function(a,b){b.id==e.id&&(e.required=b.required?!0:!1,e.points=b.points)}),d.children.push(e)}),c.render("tool_lp/competency_rule_points",d).then(function(a){e._container=b,b.html(a),b.find("input").change(function(){e._triggerChange()}),e._templateLoaded=!0,e._triggerChange()})},e.prototype.isValid=function(){if(!this._templateLoaded)return!1;var b=this._getRequiredPoints(),c=0,d=!0;return a.each(this._getCompetenciesConfig(),function(a,b){b.points<0&&(d=!1),c+=b.points}),d=d&&c>=b},e});
define(["jquery","core/str","core/templates","tool_lp/competency_rule"],function(a,b,c,d){var e=function(){d.apply(this,arguments)};return e.prototype=Object.create(d.prototype),e.prototype._container=null,e.prototype._templateLoaded=!1,e.prototype.getConfig=function(){return JSON.stringify({base:{points:this._getRequiredPoints()},competencies:this._getCompetenciesConfig()})},e.prototype._getCompetenciesConfig=function(){var b=[];return this._container.find("[data-competency]").each(function(){var c=a(this),d=c.data("competency"),e=parseInt(c.find('[name="points"]').val(),10),f=c.find('[name="required"]').prop("checked");b.push({id:d,points:e,required:f?1:0})}),b},e.prototype._getRequiredPoints=function(){return parseInt(this._container.find('[name="requiredpoints"]').val()||1,10)},e.prototype.getType=function(){return"core_competency\\competency_rule_points"},e.prototype.injectTemplate=function(b){var d,e=this,f=this._tree.getChildren(this._competency.id),g={base:{points:2},competencies:[]};if(this._templateLoaded=!1,e._competency.ruletype==e.getType())try{g=JSON.parse(e._competency.ruleconfig)}catch(h){}return d={requiredpoints:g&&g.base?g.base.points:2,competency:e._competency,children:[]},a.each(f,function(b,c){var e={id:c.id,shortname:c.shortname,required:!1,points:0};g&&a.each(g.competencies,function(a,b){b.id==e.id&&(e.required=b.required?!0:!1,e.points=b.points)}),d.children.push(e)}),c.render("tool_lp/competency_rule_points",d).then(function(a){e._container=b,b.html(a),b.find("input").change(function(){e._triggerChange()}),e._templateLoaded=!0,e._triggerChange()})},e.prototype.isValid=function(){if(!this._templateLoaded)return!1;var b=this._getRequiredPoints(),c=0,d=!0;return a.each(this._getCompetenciesConfig(),function(a,b){b.points<0&&(d=!1),c+=b.points}),d=d&&c>=b},e});

View File

@ -42,7 +42,7 @@ define(['jquery',
* @method getType
*/
Rule.prototype.getType = function() {
return 'tool_lp\\competency_rule_all';
return 'core_competency\\competency_rule_all';
};
/**

View File

@ -100,7 +100,7 @@ define(['jquery',
* @method getType
*/
Rule.prototype.getType = function() {
return 'tool_lp\\competency_rule_points';
return 'core_competency\\competency_rule_points';
};
/**

View File

@ -55,7 +55,7 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
$pluginwrapper->add_child($coursecompetencysettings);
$sql = 'SELECT s.pushratingstouserplans
FROM {' . \tool_lp\course_competency_settings::TABLE . '} s
FROM {' . \core_competency\course_competency_settings::TABLE . '} s
WHERE s.courseid = :courseid';
$coursecompetencysettings->set_source_sql($sql, array('courseid' => backup::VAR_COURSEID));
@ -65,9 +65,9 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
$coursecompetencies->add_child($competency);
$sql = 'SELECT c.idnumber, cc.ruleoutcome, cc.sortorder, f.idnumber AS frameworkidnumber
FROM {' . \tool_lp\course_competency::TABLE . '} cc
JOIN {' . \tool_lp\competency::TABLE . '} c ON c.id = cc.competencyid
JOIN {' . \tool_lp\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
FROM {' . \core_competency\course_competency::TABLE . '} cc
JOIN {' . \core_competency\competency::TABLE . '} c ON c.id = cc.competencyid
JOIN {' . \core_competency\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
WHERE cc.courseid = :courseid
ORDER BY cc.sortorder';
$competency->set_source_sql($sql, array('courseid' => backup::VAR_COURSEID));
@ -94,9 +94,9 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
$coursecompetencies->add_child($competency);
$sql = 'SELECT c.idnumber, cmc.ruleoutcome, cmc.sortorder, f.idnumber AS frameworkidnumber
FROM {' . \tool_lp\course_module_competency::TABLE . '} cmc
JOIN {' . \tool_lp\competency::TABLE . '} c ON c.id = cmc.competencyid
JOIN {' . \tool_lp\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
FROM {' . \core_competency\course_module_competency::TABLE . '} cmc
JOIN {' . \core_competency\competency::TABLE . '} c ON c.id = cmc.competencyid
JOIN {' . \core_competency\competency_framework::TABLE . '} f ON f.id = c.competencyframeworkid
WHERE cmc.cmid = :coursemoduleid
ORDER BY cmc.sortorder';
$competency->set_source_sql($sql, array('coursemoduleid' => backup::VAR_MODID));
@ -111,7 +111,7 @@ class backup_tool_lp_plugin extends backup_tool_plugin {
*/
protected function get_include_condition() {
$result = '';
if (\tool_lp\course_competency::record_exists_select('courseid = ?', array($this->task->get_courseid()))) {
if (\core_competency\course_competency::record_exists_select('courseid = ?', array($this->task->get_courseid()))) {
$result = 'include';
};
return array('sqlparam' => $result);

View File

@ -70,7 +70,7 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
$data = (object) $data;
$courseid = $this->task->get_courseid();
$exists = \tool_lp\course_competency_settings::get_record(array('courseid' => $courseid));
$exists = \core_competency\course_competency_settings::get_record(array('courseid' => $courseid));
// Now update or insert.
if ($exists) {
@ -79,7 +79,7 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
return $settings->update();
} else {
$data = (object) array('courseid' => $courseid, 'pushratingstouserplans' => $data->pushratingstouserplans);
$settings = new \tool_lp\course_competency_settings(0, $data);
$settings = new \core_competency\course_competency_settings(0, $data);
return !empty($settings->create());
}
}
@ -93,11 +93,11 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
$data = (object) $data;
// Mapping the competency by ID numbers.
$framework = \tool_lp\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
$framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
if (!$framework) {
return;
}
$competency = \tool_lp\competency::get_record(array('idnumber' => $data->idnumber,
$competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
'competencyframeworkid' => $framework->get_id()));
if (!$competency) {
return;
@ -108,13 +108,13 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
'courseid' => $this->task->get_courseid()
);
$query = 'competencyid = :competencyid AND courseid = :courseid';
$existing = \tool_lp\course_competency::record_exists_select($query, $params);
$existing = \core_competency\course_competency::record_exists_select($query, $params);
if (!$existing) {
// Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
$record = (object) $params;
$record->ruleoutcome = $data->ruleoutcome;
$coursecompetency = new \tool_lp\course_competency(0, $record);
$coursecompetency = new \core_competency\course_competency(0, $record);
$coursecompetency->create();
}
@ -129,11 +129,11 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
$data = (object) $data;
// Mapping the competency by ID numbers.
$framework = \tool_lp\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
$framework = \core_competency\competency_framework::get_record(array('idnumber' => $data->frameworkidnumber));
if (!$framework) {
return;
}
$competency = \tool_lp\competency::get_record(array('idnumber' => $data->idnumber,
$competency = \core_competency\competency::get_record(array('idnumber' => $data->idnumber,
'competencyframeworkid' => $framework->get_id()));
if (!$competency) {
return;
@ -144,13 +144,13 @@ class restore_tool_lp_plugin extends restore_tool_plugin {
'cmid' => $this->task->get_moduleid()
);
$query = 'competencyid = :competencyid AND cmid = :cmid';
$existing = \tool_lp\course_module_competency::record_exists_select($query, $params);
$existing = \core_competency\course_module_competency::record_exists_select($query, $params);
if (!$existing) {
// Sortorder is ignored by precaution, anyway we should walk through the records in the right order.
$record = (object) $params;
$record->ruleoutcome = $data->ruleoutcome;
$coursemodulecompetency = new \tool_lp\course_module_competency(0, $record);
$coursemodulecompetency = new \core_competency\course_module_competency(0, $record);
$coursemodulecompetency->create();
}

View File

@ -36,6 +36,23 @@ use require_login_exception;
use moodle_exception;
use moodle_url;
use required_capability_exception;
use \core_competency\competency;
use \core_competency\competency_framework;
use \core_competency\course_competency;
use \core_competency\course_competency_settings;
use \core_competency\course_module_competency;
use \core_competency\evidence;
use \core_competency\plan;
use \core_competency\plan_competency;
use \core_competency\related_competency;
use \core_competency\template;
use \core_competency\template_cohort;
use \core_competency\template_competency;
use \core_competency\user_competency;
use \core_competency\user_competency_course;
use \core_competency\user_competency_plan;
use \core_competency\user_evidence;
use \core_competency\user_evidence_competency;
/**
* Class for doing things with competency frameworks.
@ -1089,8 +1106,8 @@ class api {
*
* @param mixed $courseorid The course, or its ID.
* @return array( array(
* 'competency' => \tool_lp\competency,
* 'coursecompetency' => \tool_lp\course_competency
* 'competency' => \core_competency\competency,
* 'coursecompetency' => \core_competency\course_competency
* ))
*/
public static function list_course_competencies($courseorid) {
@ -1169,8 +1186,8 @@ class api {
*
* @param mixed $cmorid The course module, or its ID.
* @return array( array(
* 'competency' => \tool_lp\competency,
* 'coursemodulecompetency' => \tool_lp\course_module_competency
* 'competency' => \core_competency\competency,
* 'coursemodulecompetency' => \core_competency\course_module_competency
* ))
*/
public static function list_course_module_competencies($cmorid) {
@ -2286,7 +2303,7 @@ class api {
* Lists user plans.
*
* @param int $userid
* @return \tool_lp\plan[]
* @return \core_competency\plan[]
*/
public static function list_user_plans($userid) {
global $DB, $USER;
@ -2415,7 +2432,7 @@ class api {
* Creates a learning plan based on the provided data.
*
* @param stdClass $record
* @return \tool_lp\plan
* @return \core_competency\plan
*/
public static function create_plan(stdClass $record) {
global $USER;
@ -2445,7 +2462,7 @@ class api {
*
* @param mixed $templateorid The template object or ID.
* @param int $userid
* @return false|\tool_lp\plan Returns false when the plan already exists.
* @return false|\core_competency\plan Returns false when the plan already exists.
*/
public static function create_plan_from_template($templateorid, $userid) {
static::require_enabled();
@ -2581,7 +2598,7 @@ class api {
/**
* Unlink a plan from its template.
*
* @param \tool_lp\plan|int $planorid The plan or its ID.
* @param \core_competency\plan|int $planorid The plan or its ID.
* @return bool
*/
public static function unlink_plan_from_template($planorid) {
@ -2639,7 +2656,7 @@ class api {
* Updates a plan.
*
* @param stdClass $record
* @return \tool_lp\plan
* @return \core_competency\plan
*/
public static function update_plan(stdClass $record) {
static::require_enabled();
@ -2685,7 +2702,7 @@ class api {
* Returns a plan data.
*
* @param int $id
* @return \tool_lp\plan
* @return \core_competency\plan
*/
public static function read_plan($id) {
static::require_enabled();
@ -3106,9 +3123,9 @@ class api {
* @param int $planorid The plan, or its ID.
* @param int $competencyid The competency id.
* @return (object) array(
* 'competency' => \tool_lp\competency,
* 'usercompetency' => \tool_lp\user_competency
* 'usercompetencyplan' => \tool_lp\user_competency_plan
* 'competency' => \core_competency\competency,
* 'usercompetency' => \core_competency\user_competency
* 'usercompetencyplan' => \core_competency\user_competency_plan
* )
* The values of of keys usercompetency and usercompetencyplan cannot be defined at the same time.
*/
@ -3163,9 +3180,9 @@ class api {
*
* @param int $planorid The plan, or its ID.
* @return array((object) array(
* 'competency' => \tool_lp\competency,
* 'usercompetency' => \tool_lp\user_competency
* 'usercompetencyplan' => \tool_lp\user_competency_plan
* 'competency' => \core_competency\competency,
* 'usercompetency' => \core_competency\user_competency
* 'usercompetencyplan' => \core_competency\user_competency_plan
* ))
* The values of of keys usercompetency and usercompetencyplan cannot be defined at the same time.
*/
@ -4063,8 +4080,8 @@ class api {
* @param string $order The ordering of the sorting.
* @param int $skip Number of records to skip.
* @param int $limit Number of records to return.
* @return \tool_lp\evidence[]
* @return array of \tool_lp\evidence
* @return \core_competency\evidence[]
* @return array of \core_competency\evidence
*/
public static function list_evidence($userid = 0,
$competencyid = 0,
@ -4117,7 +4134,7 @@ class api {
* @param string $order The ordering of the sorting.
* @param int $skip Number of records to skip.
* @param int $limit Number of records to return.
* @return \tool_lp\evidence[]
* @return \core_competency\evidence[]
*/
public static function list_evidence_in_course($userid = 0,
$courseid = 0,
@ -4153,7 +4170,7 @@ class api {
* @param int $userid The user id for which evidence is added.
* @param competency|int $competencyorid The competency, or its id for which evidence is added.
* @param context|int $contextorid The context in which the evidence took place.
* @param int $action The type of action to take on the competency. \tool_lp\evidence::ACTION_*.
* @param int $action The type of action to take on the competency. \core_competency\evidence::ACTION_*.
* @param string $descidentifier The strings identifier.
* @param string $desccomponent The strings component.
* @param mixed $desca Any arguments the string requires.
@ -4448,6 +4465,7 @@ class api {
return;
}
// Fetch or create the user competency for the parent.
$userid = $usercompetency->get_userid();
$parentuc = user_competency::get_record(array('userid' => $userid, 'competencyid' => $parent->get_id()));
@ -4456,6 +4474,7 @@ class api {
$parentuc->create();
}
// Does the rule match?
if (!$rule->matches($parentuc)) {
return;
@ -4617,7 +4636,7 @@ class api {
* @param int $competencyid
* @param int $grade
* @param string $note A note to attach to the evidence
* @return array of \tool_lp\user_competency
* @return array of \core_competency\user_competency
*/
public static function grade_competency($userid, $competencyid, $grade, $note = null) {
global $USER;
@ -4666,7 +4685,7 @@ class api {
* @param int $competencyid
* @param int $grade
* @param string $note A note to attach to the evidence
* @return array of \tool_lp\user_competency
* @return array of \core_competency\user_competency
*/
public static function grade_competency_in_plan($planorid, $competencyid, $grade, $note = null) {
global $USER;
@ -4723,7 +4742,7 @@ class api {
* @param int $competencyid
* @param int $grade
* @param string $note A note to attach to the evidence
* @return array of \tool_lp\user_competency
* @return array of \core_competency\user_competency
*/
public static function grade_competency_in_course($courseorid, $userid, $competencyid, $grade, $note = null) {
global $USER, $DB;

View File

@ -29,7 +29,7 @@ global $CFG;
use tool_lp\api;
use tool_lp\external\competency_exporter;
use tool_lp\course_module_competency;
use core_competency\course_module_competency;
require_once($CFG->libdir . '/form/select.php');

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency_framework;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency_framework;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency_framework;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency_framework;
use core_competency\competency_framework;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\competency;
use core_competency\competency;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,8 +24,8 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\evidence;
use tool_lp\user_competency;
use core_competency\evidence;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\plan;
use core_competency\plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\template;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\template;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\template;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\template;
use core_competency\template;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency_course;
use core_competency\user_competency_course;
use context_course;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency_plan;
use core_competency\user_competency_plan;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
defined('MOODLE_INTERNAL') || die();
/**

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
use context_course;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency_course;
use core_competency\user_competency_course;
use context_course;
defined('MOODLE_INTERNAL') || die();

View File

@ -25,7 +25,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_competency;
use core_competency\user_competency;
use context_course;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_evidence;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_evidence;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();

View File

@ -24,7 +24,7 @@
namespace tool_lp\event;
use core\event\base;
use tool_lp\user_evidence;
use core_competency\user_evidence;
defined('MOODLE_INTERNAL') || die();

View File

@ -42,6 +42,23 @@ use external_multiple_structure;
use invalid_parameter_exception;
use required_capability_exception;
use grade_scale;
use \core_competency\competency;
use \core_competency\competency_framework;
use \core_competency\course_competency;
use \core_competency\course_competency_settings;
use \core_competency\course_module_competency;
use \core_competency\evidence;
use \core_competency\plan;
use \core_competency\plan_competency;
use \core_competency\related_competency;
use \core_competency\template;
use \core_competency\template_cohort;
use \core_competency\template_competency;
use \core_competency\user_competency;
use \core_competency\user_competency_course;
use \core_competency\user_competency_plan;
use \core_competency\user_evidence;
use \core_competency\user_evidence_competency;
use tool_lp\external\competency_framework_exporter;
use tool_lp\external\competency_summary_exporter;
use tool_lp\external\competency_path_exporter;

View File

@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die();
class competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\competency';
return 'core_competency\\competency';
}
protected static function define_related() {

View File

@ -41,7 +41,7 @@ class competency_framework_exporter extends persistent_exporter {
* @return string
*/
protected static function define_class() {
return 'tool_lp\\competency_framework';
return 'core_competency\\competency_framework';
}
/**

View File

@ -51,8 +51,8 @@ class competency_path_exporter extends exporter {
*/
protected static function define_related() {
return [
'ancestors' => 'tool_lp\\competency[]',
'framework' => 'tool_lp\\competency_framework',
'ancestors' => 'core_competency\\competency[]',
'framework' => 'core_competency\\competency_framework',
'context' => 'context'
];
}

View File

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
use context_course;
use renderer_base;
use stdClass;
use \tool_lp\competency_framework;
use \core_competency\competency_framework;
/**
* Class for exporting competency data with additional related data.
@ -40,10 +40,10 @@ class competency_summary_exporter extends exporter {
protected static function define_related() {
// We cache the context so it does not need to be retrieved from the framework every time.
return array('context' => '\\context',
'competency' => '\\tool_lp\\competency',
'framework' => '\\tool_lp\\competency_framework',
'competency' => '\\core_competency\\competency',
'framework' => '\\core_competency\\competency_framework',
'linkedcourses' => '\\stdClass[]',
'relatedcompetencies' => '\\tool_lp\\competency[]');
'relatedcompetencies' => '\\core_competency\\competency[]');
}
protected static function define_other_properties() {

View File

@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
class course_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\course_competency';
return 'core_competency\\course_competency';
}
}

View File

@ -33,7 +33,7 @@ namespace tool_lp\external;
class course_competency_settings_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\course_competency_settings';
return 'core_competency\\course_competency_settings';
}
}

View File

@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
class course_module_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\course_module_competency';
return 'core_competency\\course_module_competency';
}
}

View File

@ -39,7 +39,7 @@ class evidence_exporter extends persistent_exporter {
}
protected static function define_class() {
return 'tool_lp\\evidence';
return 'core_competency\\evidence';
}
protected function get_other_values(renderer_base $output) {

View File

@ -249,7 +249,7 @@ abstract class exporter {
* export of the persistent data.
*
* The format of the array returned by this method has to match the structure
* defined in {@link \tool_lp\persistent::define_properties()}. The display properties
* defined in {@link \core_competency\persistent::define_properties()}. The display properties
* can however do some more fancy things. They can define 'multiple' => true to wrap
* values in an external_multiple_structure automatically - or they can define the
* type as a nested array of more properties in order to generate a nested
@ -289,7 +289,7 @@ abstract class exporter {
* Return the list of properties.
*
* The format of the array returned by this method has to match the structure
* defined in {@link \tool_lp\persistent::define_properties()}.
* defined in {@link \core_competency\persistent::define_properties()}.
*
* @return array
*/

View File

@ -36,16 +36,16 @@ use coding_exception;
*/
abstract class persistent_exporter extends exporter {
/** @var \tool_lp\persistent The persistent object we will export. */
/** @var \core_competency\persistent The persistent object we will export. */
protected $persistent = null;
/**
* Constructor - saves the persistent object, and the related objects.
*
* @param \tool_lp\persistent $persistent The persistent object to export.
* @param \core_competency\persistent $persistent The persistent object to export.
* @param array $related - An optional list of pre-loaded objects related to this persistent.
*/
public final function __construct(\tool_lp\persistent $persistent, $related = array()) {
public final function __construct(\core_competency\persistent $persistent, $related = array()) {
$classname = static::define_class();
if (!$persistent instanceof $classname) {
throw new coding_exception('Invalid type for persistent. ' .

View File

@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
class plan_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\plan_competency';
return 'core_competency\\plan_competency';
}
}

View File

@ -38,11 +38,11 @@ use moodle_url;
class plan_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\plan';
return 'core_competency\\plan';
}
protected static function define_related() {
return array('template' => 'tool_lp\\template?');
return array('template' => 'core_competency\\template?');
}
protected function get_other_values(renderer_base $output) {

View File

@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
class related_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\related_competency';
return 'core_competency\\related_competency';
}
}

View File

@ -33,6 +33,6 @@ defined('MOODLE_INTERNAL') || die();
class template_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\template_competency';
return 'core_competency\\template_competency';
}
}

View File

@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die();
use moodle_url;
use renderer_base;
use tool_lp\plan;
use tool_lp\template_cohort;
use core_competency\plan;
use core_competency\template_cohort;
/**
* Class for exporting template data.
@ -38,7 +38,7 @@ use tool_lp\template_cohort;
class template_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\template';
return 'core_competency\\template';
}
protected function get_other_values(renderer_base $output) {

View File

@ -37,7 +37,7 @@ use stdClass;
class user_competency_course_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_competency_course';
return 'core_competency\\user_competency_course';
}
protected static function define_related() {

View File

@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die();
use core_user;
use renderer_base;
use stdClass;
use tool_lp\user_competency;
use core_competency\user_competency;
/**
* Class for exporting user competency data.
@ -38,7 +38,7 @@ use tool_lp\user_competency;
class user_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_competency';
return 'core_competency\\user_competency';
}
protected static function define_related() {

View File

@ -36,7 +36,7 @@ use stdClass;
class user_competency_plan_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_competency_plan';
return 'core_competency\\user_competency_plan';
}
protected static function define_related() {

View File

@ -26,7 +26,7 @@ namespace tool_lp\external;
use context_user;
use renderer_base;
use stdClass;
use tool_lp\user_competency;
use core_competency\user_competency;
/**
* Class for exporting user competency data with additional related data.
@ -38,12 +38,12 @@ class user_competency_summary_exporter extends exporter {
protected static function define_related() {
// We cache the context so it does not need to be retrieved from the framework every time.
return array('competency' => '\\tool_lp\\competency',
'relatedcompetencies' => '\\tool_lp\\competency[]',
return array('competency' => '\\core_competency\\competency',
'relatedcompetencies' => '\\core_competency\\competency[]',
'user' => '\\stdClass',
'usercompetency' => '\\tool_lp\\user_competency?',
'usercompetencyplan' => '\\tool_lp\\user_competency_plan?',
'evidence' => '\\tool_lp\\evidence[]');
'usercompetency' => '\\core_competency\\user_competency?',
'usercompetencyplan' => '\\core_competency\\user_competency_plan?',
'evidence' => '\\core_competency\\evidence[]');
}
protected static function define_other_properties() {

View File

@ -38,12 +38,12 @@ class user_competency_summary_in_course_exporter extends exporter {
protected static function define_related() {
// We cache the context so it does not need to be retrieved from the framework every time.
return array('competency' => '\\tool_lp\\competency',
'relatedcompetencies' => '\\tool_lp\\competency[]',
return array('competency' => '\\core_competency\\competency',
'relatedcompetencies' => '\\core_competency\\competency[]',
'user' => '\\stdClass',
'course' => '\\stdClass',
'usercompetencycourse' => '\\tool_lp\\user_competency_course?',
'evidence' => '\\tool_lp\\evidence[]',
'usercompetencycourse' => '\\core_competency\\user_competency_course?',
'evidence' => '\\core_competency\\evidence[]',
'scale' => '\\grade_scale');
}

View File

@ -37,13 +37,13 @@ class user_competency_summary_in_plan_exporter extends exporter {
protected static function define_related() {
// We cache the context so it does not need to be retrieved from the framework every time.
return array('competency' => '\\tool_lp\\competency',
'relatedcompetencies' => '\\tool_lp\\competency[]',
return array('competency' => '\\core_competency\\competency',
'relatedcompetencies' => '\\core_competency\\competency[]',
'user' => '\\stdClass',
'plan' => '\\tool_lp\\plan',
'usercompetency' => '\\tool_lp\\user_competency?',
'usercompetencyplan' => '\\tool_lp\\user_competency_plan?',
'evidence' => '\\tool_lp\\evidence[]');
'plan' => '\\core_competency\\plan',
'usercompetency' => '\\core_competency\\user_competency?',
'usercompetencyplan' => '\\core_competency\\user_competency_plan?',
'evidence' => '\\core_competency\\evidence[]');
}
protected static function define_other_properties() {

View File

@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die();
class user_evidence_competency_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_evidence_competency';
return 'core_competency\\user_evidence_competency';
}
}

View File

@ -35,8 +35,8 @@ use renderer_base;
class user_evidence_competency_summary_exporter extends exporter {
protected static function define_related() {
return array('competency' => '\\tool_lp\\competency',
'usercompetency' => '\\tool_lp\\user_competency',
return array('competency' => '\\core_competency\\competency',
'usercompetency' => '\\core_competency\\user_competency',
'scale' => 'grade_scale',
'context' => '\\context'
);

View File

@ -36,7 +36,7 @@ use renderer_base;
class user_evidence_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_evidence';
return 'core_competency\\user_evidence';
}
protected static function define_other_properties() {
@ -70,7 +70,7 @@ class user_evidence_exporter extends persistent_exporter {
protected static function define_related() {
return array(
'context' => 'context',
'competencies' => 'tool_lp\\competency[]'
'competencies' => 'core_competency\\competency[]'
);
}

View File

@ -38,7 +38,7 @@ use tool_lp\external\user_evidence_competency_summary_exporter;
class user_evidence_summary_exporter extends persistent_exporter {
protected static function define_class() {
return 'tool_lp\\user_evidence';
return 'core_competency\\user_evidence';
}
protected static function define_other_properties() {

View File

@ -36,7 +36,7 @@ use stdClass;
*/
class competency extends persistent {
protected static $persistentclass = 'tool_lp\\competency';
protected static $persistentclass = 'core_competency\\competency';
/**
* Define the form - called by parent constructor

View File

@ -36,7 +36,7 @@ use stdClass;
*/
class competency_framework extends persistent {
protected static $persistentclass = 'tool_lp\\competency_framework';
protected static $persistentclass = 'core_competency\\competency_framework';
/**
* Define the form - called by parent constructor
@ -95,11 +95,11 @@ class competency_framework extends persistent {
$mform->setDefault('context', $context->get_context_name(false));
$mform->addElement('header', 'taxonomyhdr', get_string('taxonomies', 'tool_lp'));
$taxonomies = \tool_lp\competency_framework::get_taxonomies_list();
$taxonomies = \core_competency\competency_framework::get_taxonomies_list();
$taxdefaults = array();
for ($i = 1; $i <= \tool_lp\competency_framework::get_taxonomies_max_level(); $i++) {
for ($i = 1; $i <= \core_competency\competency_framework::get_taxonomies_max_level(); $i++) {
$mform->addElement('select', "taxonomies[$i]", get_string('levela', 'tool_lp', $i), $taxonomies);
$taxdefaults[$i] = \tool_lp\competency_framework::TAXONOMY_COMPETENCY;
$taxdefaults[$i] = \core_competency\competency_framework::TAXONOMY_COMPETENCY;
}
// Not using taxonomies[n] here or it would takes precedence over set_data(array('taxonomies' => ...)).
$mform->setDefault('taxonomies', $taxdefaults);

View File

@ -27,7 +27,7 @@ namespace tool_lp\form;
use coding_exception;
use MoodleQuickForm_autocomplete;
use \tool_lp\competency_framework;
use \core_competency\competency_framework;
global $CFG;
require_once($CFG->libdir . '/form/autocomplete.php');

View File

@ -85,7 +85,7 @@ abstract class persistent extends moodleform {
$attributes = null, $editable = true) {
if (empty(static::$persistentclass)) {
throw new coding_exception('Static property $persistentclass must be set.');
} else if (!is_subclass_of(static::$persistentclass, 'tool_lp\\persistent')) {
} else if (!is_subclass_of(static::$persistentclass, 'core_competency\\persistent')) {
throw new coding_exception('Static property $persistentclass is not valid.');
} else if (!array_key_exists('persistent', $customdata)) {
throw new coding_exception('The custom data \'persistent\' key must be set, even if it is null.');

View File

@ -25,7 +25,7 @@
namespace tool_lp\form;
defined('MOODLE_INTERNAL') || die();
use tool_lp\plan as planpersistent;
use core_competency\plan as planpersistent;
use required_capability_exception;
/**
@ -37,7 +37,7 @@ use required_capability_exception;
*/
class plan extends persistent {
protected static $persistentclass = 'tool_lp\\plan';
protected static $persistentclass = 'core_competency\\plan';
/**
* Define the form - called by parent constructor

View File

@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
*/
class template extends persistent {
protected static $persistentclass = 'tool_lp\\template';
protected static $persistentclass = 'core_competency\\template';
/**
* Define the form - called by parent constructor

View File

@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
*/
class user_evidence extends persistent {
protected static $persistentclass = 'tool_lp\\user_evidence';
protected static $persistentclass = 'core_competency\\user_evidence';
protected static $foreignfields = array('files');

View File

@ -39,13 +39,13 @@ use tool_lp\external\competency_summary_exporter;
*/
class competency_summary implements renderable, templatable {
/** @var \tool_lp\competency_framework $framework This competency framework. */
/** @var \core_competency\competency_framework $framework This competency framework. */
protected $framework = null;
/** @var \tool_lp\competency $competency. */
/** @var \core_competency\competency $competency. */
protected $competency = null;
/** @var \tool_lp\competency[] $relatedcompetencies List of competencies. */
/** @var \core_competency\competency[] $relatedcompetencies List of competencies. */
protected $relatedcompetencies = array();
/** @var course[] $courses List of courses. */
@ -54,8 +54,8 @@ class competency_summary implements renderable, templatable {
/**
* Construct this renderable.
*
* @param \tool_lp\competency $competency Competency persistent.
* @param \tool_lp\competency_framework $framework framework persistent.
* @param \core_competency\competency $competency Competency persistent.
* @param \core_competency\competency_framework $framework framework persistent.
* @param boolean $includerelated Include or not related competencies.
* @param boolean $includecourses Include or not competency courses.
*/

View File

@ -32,9 +32,9 @@ use moodle_url;
use context_system;
use context_course;
use tool_lp\api;
use tool_lp\course_competency;
use tool_lp\course_competency_statistics;
use tool_lp\competency;
use core_competency\course_competency;
use core_competency\course_competency_statistics;
use core_competency\competency;
use tool_lp\external\competency_exporter;
use tool_lp\external\competency_path_exporter;
use tool_lp\external\course_competency_exporter;
@ -58,7 +58,7 @@ class course_competencies_page implements renderable, templatable {
/** @var context $context The context for this page. */
protected $context = null;
/** @var \tool_lp\course_competency[] $competencies List of competencies. */
/** @var \core_competency\course_competency[] $competencies List of competencies. */
protected $coursecompetencylist = array();
/** @var bool $canmanagecompetencyframeworks Can the current user manage competency frameworks. */

View File

@ -32,8 +32,8 @@ use stdClass;
use moodle_url;
use context_system;
use tool_lp\api;
use tool_lp\competency;
use tool_lp\competency_framework;
use core_competency\competency;
use core_competency\competency_framework;
use tool_lp\external\competency_framework_exporter;
/**
@ -44,10 +44,10 @@ use tool_lp\external\competency_framework_exporter;
*/
class manage_competencies_page implements renderable, templatable {
/** @var \tool_lp\competency_framework $framework This competency framework. */
/** @var \core_competency\competency_framework $framework This competency framework. */
protected $framework = null;
/** @var \tool_lp\competency[] $competencies List of competencies. */
/** @var \core_competency\competency[] $competencies List of competencies. */
protected $competencies = array();
/** @var string $search Text to search for. */
@ -65,7 +65,7 @@ class manage_competencies_page implements renderable, templatable {
/**
* Construct this renderable.
*
* @param \tool_lp\competency_framework $framework Competency framework.
* @param \core_competency\competency_framework $framework Competency framework.
* @param string $search Search string.
* @param context $pagecontext The page context.
*/

View File

@ -33,7 +33,7 @@ use moodle_url;
use context;
use context_system;
use tool_lp\api;
use tool_lp\competency_framework;
use core_competency\competency_framework;
use tool_lp\external\competency_framework_exporter;
/**

View File

@ -33,7 +33,7 @@ use stdClass;
use moodle_url;
use context_system;
use tool_lp\api;
use tool_lp\template;
use core_competency\template;
use tool_lp\external\template_exporter;
/**

View File

@ -29,7 +29,7 @@ use templatable;
use stdClass;
use moodle_url;
use tool_lp\api;
use tool_lp\plan;
use core_competency\plan;
use tool_lp\external\competency_exporter;
use tool_lp\external\competency_path_exporter;
use tool_lp\external\plan_exporter;

View File

@ -32,8 +32,8 @@ use single_button;
use moodle_url;
use tool_lp\api;
use tool_lp\external\plan_exporter;
use tool_lp\plan;
use tool_lp\user_evidence;
use core_competency\plan;
use core_competency\user_evidence;
use context_user;
/**
@ -47,7 +47,7 @@ class plans_page implements renderable, templatable {
/** @var array $navigation List of links to display on the page. Each link contains a url and a title. */
protected $navigation = array();
/** @var array|\tool_lp\plan[] $plans List of plans. */
/** @var array|\core_competency\plan[] $plans List of plans. */
protected $plans = array();
/** @var context_user|null $context context. */
@ -88,7 +88,7 @@ class plans_page implements renderable, templatable {
$data->canreaduserevidence = user_evidence::can_read_user($this->userid);
$data->canmanageuserplans = plan::can_manage_user($this->userid);
// Attach standard objects as mustache can not parse \tool_lp\plan objects.
// Attach standard objects as mustache can not parse \core_competency\plan objects.
$data->plans = array();
if ($this->plans) {
foreach ($this->plans as $plan) {

View File

@ -36,10 +36,10 @@ class template_cohorts_page implements \renderable {
/**
* Constructor.
* @param \tool_lp\template $template
* @param \core_competency\template $template
* @param \moodle_url $url
*/
public function __construct(\tool_lp\template $template, \moodle_url $url) {
public function __construct(\core_competency\template $template, \moodle_url $url) {
$this->template = $template;
$this->url = $url;
$this->table = new template_cohorts_table('tplcohorts', $template);

View File

@ -30,7 +30,7 @@ require_once($CFG->libdir . '/tablelib.php');
use html_writer;
use moodle_url;
use table_sql;
use tool_lp\template;
use core_competency\template;
/**
* Template cohorts table class.
@ -47,16 +47,16 @@ class template_cohorts_table extends table_sql {
/** @var context The context. */
protected $context;
/** @var \tool_lp\template The template. */
/** @var \core_competency\template The template. */
protected $template;
/**
* Sets up the table.
*
* @param string $uniqueid Unique id of table.
* @param \tool_lp\template $template The template.
* @param \core_competency\template $template The template.
*/
public function __construct($uniqueid, \tool_lp\template $template) {
public function __construct($uniqueid, \core_competency\template $template) {
parent::__construct($uniqueid);
// This object should not be used without the right permissions.
@ -138,7 +138,7 @@ class template_cohorts_table extends table_sql {
}
$sql = "SELECT $select
FROM {" . \tool_lp\template_cohort::TABLE . "} tc
FROM {" . \core_competency\template_cohort::TABLE . "} tc
JOIN {cohort} c ON c.id = tc.cohortid
WHERE tc.templateid = :templateid";
$params = array('templateid' => $this->template->get_id());

View File

@ -33,8 +33,8 @@ use context_system;
use moodle_url;
use tool_lp\api;
use tool_lp\external\competency_summary_exporter;
use tool_lp\template;
use tool_lp\template_statistics;
use core_competency\template;
use core_competency\template_statistics;
use tool_lp\external\template_exporter;
use tool_lp\external\template_statistics_exporter;
@ -49,7 +49,7 @@ class template_competencies_page implements renderable, templatable {
/** @var template $template Template for this page. */
protected $template = null;
/** @var \tool_lp\competency[] $competencies List of competencies. */
/** @var \core_competency\competency[] $competencies List of competencies. */
protected $competencies = array();
/** @var bool $canmanagecompetencyframeworks Can the current user manage competency frameworks. */

View File

@ -36,10 +36,10 @@ class template_plans_page implements \renderable {
/**
* Constructor.
* @param \tool_lp\template $template
* @param \core_competency\template $template
* @param \moodle_url $url
*/
public function __construct(\tool_lp\template $template, \moodle_url $url) {
public function __construct(\core_competency\template $template, \moodle_url $url) {
$this->template = $template;
$this->url = $url;
$this->table = new template_plans_table('tplplans', $template);

View File

@ -30,7 +30,7 @@ require_once($CFG->libdir . '/tablelib.php');
use html_writer;
use moodle_url;
use table_sql;
use tool_lp\template;
use core_competency\template;
/**
* Template plans table class.
@ -47,16 +47,16 @@ class template_plans_table extends table_sql {
/** @var context The context. */
protected $context;
/** @var \tool_lp\template The template. */
/** @var \core_competency\template The template. */
protected $template;
/**
* Sets up the table.
*
* @param string $uniqueid Unique id of table.
* @param \tool_lp\template $template The template.
* @param \core_competency\template $template The template.
*/
public function __construct($uniqueid, \tool_lp\template $template) {
public function __construct($uniqueid, \core_competency\template $template) {
parent::__construct($uniqueid);
// This object should not be used without the right permissions.
@ -147,7 +147,7 @@ class template_plans_table extends table_sql {
}
$sql = "SELECT $select
FROM {" . \tool_lp\plan::TABLE . "} p
FROM {" . \core_competency\plan::TABLE . "} p
JOIN {user} u ON u.id = p.userid
WHERE p.templateid = :templateid";
$params = array('templateid' => $this->template->get_id());

View File

@ -29,7 +29,7 @@ use renderer_base;
use renderable;
use templatable;
use tool_lp\api;
use tool_lp\user_competency;
use core_competency\user_competency;
use tool_lp\external\user_competency_summary_exporter;
/**

View File

@ -27,7 +27,7 @@ use renderable;
use renderer_base;
use templatable;
use tool_lp\api;
use tool_lp\user_competency;
use core_competency\user_competency;
use tool_lp\external\user_competency_summary_in_course_exporter;
/**

View File

@ -31,7 +31,7 @@ use single_button;
use moodle_url;
use tool_lp\api;
use tool_lp\external\user_evidence_summary_exporter;
use tool_lp\user_evidence;
use core_competency\user_evidence;
use context_user;
/**

View File

@ -99,7 +99,7 @@ class page_helper {
*
* @param int $pagecontextid The page context ID.
* @param moodle_url $url The current page.
* @param \tool_lp\template $template The template, if any.
* @param \core_competency\template $template The template, if any.
* @param string $subtitle The title of the subpage, if any.
* @param string $returntype The desired return page.
* @return array With the following:
@ -177,7 +177,7 @@ class page_helper {
*
* @param int $userid The user ID.
* @param moodle_url $url The current page.
* @param \tool_lp\plan $plan The plan, if any.
* @param \core_competency\plan $plan The plan, if any.
* @param string $subtitle The title of the subpage, if any.
* @param string $returntype The desired return page.
* @return array With the following:
@ -251,7 +251,7 @@ class page_helper {
*
* @param int $userid The user ID.
* @param moodle_url $url The current page.
* @param \tool_lp\user_evidence $evidence The user evidence, if any.
* @param \core_competency\user_evidence $evidence The user evidence, if any.
* @param string $subtitle The title of the subpage, if any.
* @param string $returntype The desired return page.
* @return array With the following:
@ -325,7 +325,7 @@ class page_helper {
*
* @param int $id The framework ID.
* @param int $pagecontextid The page context ID.
* @param \tool_lp\competency_framework $framework The framework.
* @param \core_competency\competency_framework $framework The framework.
* @param string $returntype The desired return page.
* @return array With the following:
* - Page title
@ -385,9 +385,9 @@ class page_helper {
*
* @param int $pagecontextid The page context ID.
* @param moodle_url $url The current page.
* @param \tool_lp\competency_framework $framework The competency framework.
* @param \tool_lp\competency $competency The competency, if any.
* @param \tool_lp\competency $parent The parent competency, if any.
* @param \core_competency\competency_framework $framework The competency framework.
* @param \core_competency\competency $competency The competency, if any.
* @param \core_competency\competency $parent The parent competency, if any.
* @return array With the following:
* - Page title
* - Page sub title

View File

@ -25,6 +25,10 @@
namespace tool_lp;
defined('MOODLE_INTERNAL') || die();
use core_competency\api;
use core_competency\plan;
use core_competency\template;
/**
* Template statistics class.
*

View File

@ -36,7 +36,7 @@ $pagecontext = context::instance_by_id($pagecontextid);
$framework = \tool_lp\api::read_framework($id);
$context = $framework->get_context();
if (!\tool_lp\competency_framework::can_read_context($context)) {
if (!\core_competency\competency_framework::can_read_context($context)) {
throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
}

View File

@ -34,7 +34,7 @@ $url->param('pagecontextid', $pagecontextid);
require_login();
\tool_lp\api::require_enabled();
if (!\tool_lp\competency_framework::can_read_context($context)) {
if (!\core_competency\competency_framework::can_read_context($context)) {
throw new required_capability_exception($context, 'moodle/competency:competencyview', 'nopermissions', '');
}

Some files were not shown because too many files have changed in this diff Show More