* @return string HTML to output.
*/
private function section_activity_summary($section, $course, $mods) {
- $completioninfo = new completion_info($course);
if (empty($section->sequence)) {
return '';
}
$sectionmods = array();
$total = 0;
$complete = 0;
+ $cancomplete = isloggedin() && !isguestuser();
+ $completioninfo = new completion_info($course);
$modsequence = explode(',', $section->sequence);
foreach ($modsequence as $cmid) {
$thismod = $mods[$cmid];
$sectionmods[$thismod->modname]['name'] = $thismod->modplural;
$sectionmods[$thismod->modname]['count'] = 1;
}
- if ($completioninfo->is_enabled($thismod) != COMPLETION_TRACKING_NONE && isloggedin() &&
- !isguestuser() && $thismod->uservisible) {
+ if ($cancomplete && $completioninfo->is_enabled($thismod) != COMPLETION_TRACKING_NONE) {
$total++;
- $completiondata = $completioninfo->get_data($thismod,true);
+ $completiondata = $completioninfo->get_data($thismod, true);
if ($completiondata->completionstate == COMPLETION_COMPLETE) {
$complete++;
}
$o.= html_writer::end_tag('div');
// Output section completion data
- if ($completioninfo->is_enabled() != COMPLETION_TRACKING_NONE && isloggedin() &&
- !isguestuser() && $total !== 0) {
+ if ($total > 0) {
+ $a = new stdClass;
+ $a->complete = $complete;
+ $a->total = $total;
+
$o.= html_writer::start_tag('div', array('class' => 'section-summary-activities mdl-right'));
- $o.= html_writer::start_tag('span', array('class' => 'activity-count'));
- $o.= get_string("progress")." $complete / $total";
- $o.= html_writer::end_tag('span');
+ $o.= html_writer::tag('span', get_string('progresstotal', 'completion', $a), array('class' => 'activity-count'));
$o.= html_writer::end_tag('div');
}
$string['excelcsvdownload'] = 'Download in Excel-compatible format (.csv)';
$string['progress'] = 'Student progress';
$string['progress-title'] = '{$a->user}, {$a->activity}: {$a->state} {$a->date}';
+$string['progresstotal'] = 'Progress: {$a->complete} / {$a->total}';
$string['reportpage'] = 'Showing users {$a->from} to {$a->to} of {$a->total}.';
$string['restoringcompletiondata'] = 'Writing completion data';
$string['saved'] = 'Saved';
$string['primaryadminsetup'] = 'Setup administrator account';
$string['profile'] = 'Profile';
$string['profilenotshown'] = 'This profile description will not be shown until this person is enrolled in at least one course.';
-$string['progress'] = 'Progress:';
$string['publicprofile'] = 'Public profile';
$string['publicsitefileswarning'] = 'Note: files placed here can be accessed by anyone';
$string['publicsitefileswarning2'] = 'Note: Files placed here can be accessed by anyone who knows (or can guess) the URL. For security reasons, it is recommended that any backup files are deleted immediately after restoring them.';