// Load user
if ($userid) {
- if (!$user = $DB->get_record('user', array('id' => $userid))) {
- error('User ID incorrect');
- }
+ $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
} else {
- $user =& $USER;
+ $user = $USER;
}
}
if (!$can_view) {
- error('You do not have permissions to view this report');
+ print_error('cannotviewreport');
}
// Don't display if completion isn't enabled!
if (!$course->enablecompletion) {
- error('completion not enabled');
+ print_error('completionnotenabled', 'block_completionstatus');
}
// Load criteria to display
// Check if this course has any criteria
if (empty($completions)) {
- error('no criteria');
+ print_error('nocriteria', 'block_completionstatus');
}
// Check this user is enroled
if (!$info->is_tracked_user($user->id)) {
- error(get_string('notenroled', 'completion'));
+ print_error('notenroled', 'completion');
}
$page = get_string('completionprogressdetails', 'block_completionstatus');
$title = format_string($course->fullname) . ': ' . $page;
-$navlinks[] = array('name' => $page, 'link' => null, 'type' => 'misc');
-$navigation = build_navigation($navlinks);
-
+$PAGE->navbar->add($page);
+$PAGE->set_pagelayout('standard');
$PAGE->set_url('/blocks/completionstatus/details.php', array('course' => $course->id));
$PAGE->set_title(get_string('course') . ': ' . $course->fullname);
$PAGE->set_heading($title);
<?php
+$string['completionnotenabled'] = 'Course completion is not enabled';
$string['completionprogressdetails'] = 'Completion progress details';
$string['completionstatus'] = 'Course completion status';
-$string['pluginname'] = 'Course completion status';
$string['criteriagroup'] = 'Criteria group';
+$string['nocriteria'] = 'No criteria have been set for this course';
+$string['pluginname'] = 'Course completion status';
$string['requirement'] = 'Requirement';
$string['cannotusepage'] = 'Only teachers and administrators can use this page';
$string['cannotusepage2'] = 'Sorry, you may not use this page';
$string['cannotviewprofile'] = 'You cannot view the profile of this user';
+$string['cannotviewreport'] = 'You cannot view this report';
$string['cannotwritefile'] = 'Cannot write to file ({$a})';
$string['commentmisconf'] = 'Comment ID is misconfigured';
$string['componentisuptodate'] = 'Component is up-to-date';