mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-51043 cbe: Competency breakdown report
This commit is contained in:
parent
0845a3a09a
commit
bf780fbfe0
10 changed files with 404 additions and 0 deletions
|
@ -740,6 +740,33 @@ class api {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the user competencies in a course.
|
||||
*
|
||||
* @param int $courseid The id of the course to check.
|
||||
* @param int $userid The id of the course to check.
|
||||
* @return array of competencies
|
||||
*/
|
||||
public static function list_user_competencies_in_course($courseid, $userid) {
|
||||
// First we do a permissions check.
|
||||
$context = context_course::instance($courseid);
|
||||
$onlyvisible = 1;
|
||||
|
||||
$capabilities = array('tool/lp:coursecompetencyread', 'tool/lp:coursecompetencymanage');
|
||||
if (!has_any_capability($capabilities, $context)) {
|
||||
throw new required_capability_exception($context, 'tool/lp:coursecompetencyread', 'nopermissions', '');
|
||||
}
|
||||
|
||||
if (has_capability('tool/lp:coursecompetencymanage', $context)) {
|
||||
$onlyvisible = 0;
|
||||
}
|
||||
|
||||
// OK - all set.
|
||||
$competencylist = course_competency::list_competencies($courseid, $onlyvisible);
|
||||
|
||||
return user_competency::get_multiple($userid, $competencylist);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a competency to this course.
|
||||
*
|
||||
|
|
|
@ -52,6 +52,14 @@ $capabilities = array(
|
|||
),
|
||||
'clonepermissionsfrom' => 'moodle/site:backup'
|
||||
),
|
||||
'tool/lp:coursecompetencygradable' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
'archetypes' => array(
|
||||
'student' => CAP_ALLOW
|
||||
),
|
||||
'clonepermissionsfrom' => 'moodle/course:isincompletionreports'
|
||||
),
|
||||
'tool/lp:coursecompetencyread' => array(
|
||||
'captype' => 'read',
|
||||
'contextlevel' => CONTEXT_COURSE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue