Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lang/en/block_completion_progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,5 @@
$string['why_use_icons'] = 'Why you might want to use icons?';
$string['why_use_icons_help'] = '<p>You may wish to add tick and cross icons in the Completion Progress to make this block more visually accessible for students with colour-blindness.</p><p>It may also make the meaning of the block clearer if you believe colours are not intuitive, either for cultural or personal reasons.</p>';
$string['wrapafter'] = 'When wrapping, limit rows to';
$string['roles_to_exclude'] = 'Roles to not display and not use and the block';
$string['roles_to_exclude_desc'] = 'Roles list to not display or not use in this block and in the overview report. If an user owns one of theses roles the user will not appear in the block informations and his progress will not be displayed.';
11 changes: 10 additions & 1 deletion overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,14 @@
}

// Output the roles menu.
$rolestoexclude = get_config('block_completion_progress' ,'roles_to_exclude');
$sql = "SELECT DISTINCT r.id, r.name, r.shortname
FROM {role} r, {role_assignments} a
WHERE a.contextid = :contextid
AND r.id = a.roleid";
if ($rolestoexclude != "") {
$sql .= " AND r.id not in ($rolestoexclude)";
}
$params = array('contextid' => $context->id);
$roles = role_fix_names($DB->get_records_sql($sql, $params), $context);
$rolestodisplay = array(0 => get_string('allparticipants'));
Expand Down Expand Up @@ -206,8 +210,13 @@
FROM {user} u
JOIN {role_assignments} a ON (a.contextid = :contextid AND a.userid = u.id $rolewhere)
$groupjoin
LEFT JOIN {user_lastaccess} l ON (l.courseid = :courseid AND l.userid = u.id)";
LEFT JOIN {user_lastaccess} l ON (l.courseid = :courseid AND l.userid = u.id)";
if ($rolestoexclude != "") {
$sql .= " WHERE a.userid not in
(SELECT userid FROM {role_assignments} WHERE contextid = :subcontextid AND roleid IN ($rolestoexclude))";
}
$params['contextid'] = $context->id;
$params['subcontextid'] = $context->id;
$params['courseid'] = $course->id;
$userrecords = $DB->get_records_sql($sql, $params);
if (get_config('block_completion_progress', 'showinactive') !== "1") {
Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@
'',
DEFAULT_COMPLETIONPROGRESS_FORCEICONSINBAR)
);

$settings->add(new admin_setting_pickroles(
'block_completion_progress/roles_to_exclude',
get_string('roles_to_exclude', 'block_completion_progress'),
get_string('roles_to_exclude_desc', 'block_completion_progress'),
null
));
}