diff -Nrup /Volumes/elearning/report/completion/index.php /Volumes/devmoodle/report/completion/index.php --- /Volumes/elearning/report/completion/index.php 2012-09-19 14:54:26.000000000 -0500 +++ /Volumes/devmoodle/report/completion/index.php 2012-12-04 16:00:54.000000000 -0600 @@ -42,7 +42,7 @@ $courseid = required_param('course', PAR $format = optional_param('format','',PARAM_ALPHA); $sort = optional_param('sort','',PARAM_ALPHA); $edituser = optional_param('edituser', 0, PARAM_INT); - +$onlyactive = optional_param('onlyactive', true, PARAM_BOOL); $course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); $context = context_course::instance($course->id); @@ -183,6 +183,16 @@ if ($csv) { // Handle groups (if enabled) groups_print_course_menu($course, $CFG->wwwroot.'/report/completion/?course='.$course->id); + + global $OUTPUT; + $select = new single_select( + new moodle_url("/report/completion/index.php", + array('course'=>$courseid, 'start'=>$start, 'sifirst'=>$sifirst, 'silast'=>$silast)), + 'onlyactive', + array(1=>get_string('yes'), 0=>get_string('no')), $onlyactive, null, "onlyactive" + ); + $select->set_label(get_string('onlyactive', 'report_completion')); + echo $OUTPUT->render($select); } @@ -201,10 +211,10 @@ if ($silast !== 'all') { } // Get user match count -$total = $completion->get_num_tracked_users(implode(' AND ', $where), $where_params, $group); +$total = $completion->get_num_tracked_users(implode(' AND ', $where), $where_params, $group, $onlyactive); // Total user count -$grandtotal = $completion->get_num_tracked_users('', array(), $group); +$grandtotal = $completion->get_num_tracked_users('', array(), $group, $onlyactive); // If no users in this course what-so-ever if (!$grandtotal) { @@ -224,13 +234,14 @@ if ($total) { $firstnamesort ? 'u.firstname ASC' : 'u.lastname ASC', $csv ? 0 : COMPLETION_REPORT_PAGE, $csv ? 0 : $start, - $context + $context, + $onlyactive ); } // Build link for paging -$link = $CFG->wwwroot.'/report/completion/?course='.$course->id; +$link = $CFG->wwwroot.'/report/completion/?course='.$course->id.'&onlyactive='.$onlyactive; if (strlen($sort)) { $link .= '&sort='.$sort; } diff -Nrup /Volumes/elearning/report/completion/lang/en/report_completion.php /Volumes/devmoodle/report/completion/lang/en/report_completion.php --- /Volumes/elearning/report/completion/lang/en/report_completion.php 2012-09-19 14:54:26.000000000 -0500 +++ /Volumes/devmoodle/report/completion/lang/en/report_completion.php 2012-12-04 15:30:49.000000000 -0600 @@ -30,3 +30,4 @@ $string['page-report-completion-x'] = 'A $string['page-report-completion-index'] = 'Course completion report'; $string['page-report-completion-user'] = 'User course completion report'; $string['pluginname'] = 'Course completion'; +$string['onlyactive'] = 'Display only currently active enrollments';