MDL-51506 tool_lp: Migrating competency_framework to new model API

This commit is contained in:
Frederic Massart
2016-04-18 10:58:34 +08:00
parent c27113d93e
commit b60702643c
3 changed files with 74 additions and 233 deletions
+2 -7
View File
@@ -363,9 +363,6 @@ class api {
$framework = new competency_framework($record->id);
// Check the permissions before update.
require_capability('tool/lp:competencymanage', $framework->get_context());
if (isset($record->contextid) && $record->contextid != $framework->get_contextid()) {
throw new coding_exception('Changing the context of an existing framework is forbidden.');
}
$framework->from_record($record);
return $framework->update();
}
@@ -415,9 +412,8 @@ class api {
}
// OK - all set.
$framework = new competency_framework();
list($insql, $inparams) = $DB->get_in_or_equal(array_keys($contexts), SQL_PARAMS_NAMED);
return $framework->get_records_select("contextid $insql", $inparams, $sort, '*', $skip, $limit);
return competency_framework::get_records_select("contextid $insql", $inparams, $sort, '*', $skip, $limit);
}
/**
@@ -445,9 +441,8 @@ class api {
}
// OK - all set.
$framework = new competency_framework();
list($insql, $inparams) = $DB->get_in_or_equal(array_keys($contexts), SQL_PARAMS_NAMED);
return $framework->count_records_select("contextid $insql", $inparams);
return competency_framework::count_records_select("contextid $insql", $inparams);
}
/**