Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

completion MDL-25929 Remove progresstrackedroles option

  • Loading branch information...
commit 1c6ed50500ba3bef3d53f969f74c6db2643a4ceb 1 parent 46f4c39
sam marshall sammarshallou authored
4 admin/settings/subsystems.php
View
@@ -37,10 +37,6 @@
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecompletion',
get_string('enablecompletion','completion'),
get_string('configenablecompletion','completion'), 0));
- $optionalsubsystems->add(new admin_setting_pickroles('progresstrackedroles',
- get_string('progresstrackedroles','completion'),
- get_string('configprogresstrackedroles', 'completion'),
- array('student')));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableavailability',
get_string('enableavailability','condition'),
get_string('configenableavailability','condition'), 0));
2  course/report/completion/mod.php
View
@@ -10,7 +10,7 @@
$completion = new completion_info($course);
if ($completion->is_enabled() && $completion->has_criteria()) {
echo '<p>';
- echo '<a href="'.$CFG->wwwroot.'/course/report/completion/index.php?coursetest='.$course->id.'">'.get_string('coursecompletion').'</a>';
+ echo '<a href="'.$CFG->wwwroot.'/course/report/completion/index.php?course='.$course->id.'">'.get_string('coursecompletion').'</a>';
echo '</p>';
}
}
28 course/report/progress/index.php
View
@@ -72,9 +72,6 @@ function csv_quote($value) {
$reportsurl=$CFG->wwwroot.'/course/report.php?id='.$course->id;
$completion=new completion_info($course);
$activities=$completion->get_activities();
-if(count($activities)==0) {
- print_error('err_noactivities','completion',$reportsurl);
-}
// Generate where clause
$where = array();
@@ -96,16 +93,6 @@ function csv_quote($value) {
// Total user count
$grandtotal = $completion->get_num_tracked_users('', array(), $group);
-// If no users in this course what-so-ever
-if (!$grandtotal) {
- echo $OUTPUT->box_start('errorbox errorboxcontent boxaligncenter boxwidthnormal');
- echo '<p class="nousers">'.get_string('err_nousers','completion').'</p>';
- echo '<p><a href="'.$CFG->wwwroot.'/course/report.php?id='.$course->id.'">'.get_string('continue').'</a></p>';
- echo $OUTPUT->box_end();
- echo $OUTPUT->footer();
- exit;
-}
-
// Get user data
$progress = array();
@@ -120,7 +107,7 @@ function csv_quote($value) {
);
}
-if($csv) {
+if($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are some users/actvs
header('Content-Disposition: attachment; filename=progress.'.
preg_replace('/[^a-z0-9-]/','_',strtolower($course->shortname)).'.csv');
// Unicode byte-order mark for Excel
@@ -155,6 +142,19 @@ function csv_quote($value) {
groups_print_course_menu($course,$CFG->wwwroot.'/course/report/progress/?course='.$course->id);
}
+if(count($activities)==0) {
+ echo $OUTPUT->container(get_string('err_noactivities', 'completion'), 'errorbox errorboxcontent');
+ echo $OUTPUT->footer();
+ exit;
+}
+
+// If no users in this course what-so-ever
+if (!$grandtotal) {
+ echo $OUTPUT->container(get_string('err_nousers', 'completion'), 'errorbox errorboxcontent');
+ echo $OUTPUT->footer();
+ exit;
+}
+
// Build link for paging
$link = $CFG->wwwroot.'/course/report/progress/?course='.$course->id;
if (strlen($sort)) {
10 course/user.php
View
@@ -367,13 +367,19 @@
{context} con
ON con.instanceid = c.id
INNER JOIN
+ {enrol} e
+ ON c.id = e.courseid
+ INNER JOIN
+ {user_enrolments} ue
+ ON e.id = ue.enrolid
+ INNER JOIN
{role_assignments} ra
- ON ra.contextid = con.id
+ ON ra.contextid = con.id AND ra.userid=ue.userid
AND ra.userid = {$user->id}
";
// Get roles that are tracked by course completion
- if ($roles = $CFG->progresstrackedroles) {
+ if ($roles = $CFG->gradebookroles) {
$sql .= '
AND ra.roleid IN ('.$roles.')
';
2  lang/en/completion.php
View
@@ -62,7 +62,6 @@
$string['completionview'] = 'Require view';
$string['completionview_desc'] = 'Student must view this activity to complete it';
$string['configenablecompletion'] = 'When enabled, this lets you turn on completion tracking (progress) features at course level.';
-$string['configprogresstrackedroles'] = 'Roles that are displayed in the progress-tracking screen. (Usually includes just students and equivalent roles.)';
$string['csvdownload'] = 'Download in spreadsheet format (UTF-8 .csv)';
$string['deletecoursecompletiondata'] = 'Delete course completion data';
$string['enablecompletion'] = 'Enable completion tracking';
@@ -130,7 +129,6 @@
$string['periodpostenrolment']='Period post enrolment';
$string['prerequisites']='Prerequisites';
$string['prerequisitescompleted']='Prerequisites completed';
-$string['progresstrackedroles']='Progress-tracked roles';
$string['recognitionofpriorlearning']='Recognition of prior learning';
$string['remainingenroledfortime']='Remaining enrolled for a specified period of time';
$string['remainingenroleduntildate']='Remaining enrolled until a specified date';
4 lib/completion/cron.php
View
@@ -57,8 +57,8 @@ function completion_cron_mark_started() {
mtrace('Marking users as started');
}
- if (!empty($CFG->progresstrackedroles)) {
- $roles = ' AND ra.roleid IN ('.$CFG->progresstrackedroles.')';
+ if (!empty($CFG->gradebookroles)) {
+ $roles = ' AND ra.roleid IN ('.$CFG->gradebookroles.')';
} else {
// This causes it to default to everyone (if there is no student role)
$roles = '';
6 lib/completionlib.php
View
@@ -1073,8 +1073,8 @@ function generate_tracked_user_sql($groupid = 0) {
$return->sql = '';
$return->data = array();
- if (!empty($CFG->progresstrackedroles)) {
- $roles = ' AND ra.roleid IN ('.$CFG->progresstrackedroles.')';
+ if (!empty($CFG->gradebookroles)) {
+ $roles = ' AND ra.roleid IN ('.$CFG->gradebookroles.')';
} else {
// This causes it to default to everyone (if there is no student role)
$roles = '';
@@ -1142,7 +1142,7 @@ function generate_tracked_user_sql($groupid = 0) {
* for all users in a specific group. Intended for use when displaying progress.
*
* This includes only users who, in course context, have one of the roles for
- * which progress is tracked (the progresstrackedroles admin option).
+ * which progress is tracked (the gradebookroles admin option) and are enrolled in course.
*
* Users are included (in the first array) even if they do not have
* completion progress for any course-module.
Please sign in to comment.
Something went wrong with that request. Please try again.