blocks-completionstatus MDL-19791 Converted deprecated calls

This commit is contained in:
Sam Hemelryk
2010-09-22 08:22:58 +00:00
parent 532a91d431
commit a49cef3e3e
3 changed files with 12 additions and 12 deletions
+8 -11
View File
@@ -43,11 +43,9 @@ $course = $DB->get_record('course', array('id' => $id));
// 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;
}
@@ -74,13 +72,13 @@ elseif (has_capability('coursereport/completion:view', $personalcontext)) {
}
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
@@ -89,12 +87,12 @@ $completions = $info->get_completions($user->id);
// 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');
}
@@ -106,9 +104,8 @@ if (!$info->is_tracked_user($user->id)) {
$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);
@@ -1,7 +1,9 @@
<?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';
+1
View File
@@ -154,6 +154,7 @@ $string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin use
$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';