Merge branch 'MDL-40241_master' of https://github.com/dmonllao/moodle

This commit is contained in:
Dan Poltawski 2014-12-01 15:46:34 +00:00
commit 7b58b245bf
6 changed files with 82 additions and 12 deletions

View file

@ -57,6 +57,8 @@ class block_completionstatus extends block_base {
// Create empty content.
$this->content = new stdClass();
$this->content->text = '';
$this->content->footer = '';
// Can edit settings?
$can_edit = has_capability('moodle/course:update', $context);
@ -67,13 +69,13 @@ class block_completionstatus extends block_base {
// Don't display if completion isn't enabled!
if (!completion_info::is_enabled_for_site()) {
if ($can_edit) {
$this->content->text = get_string('completionnotenabledforsite', 'completion');
$this->content->text .= get_string('completionnotenabledforsite', 'completion');
}
return $this->content;
} else if (!$info->is_enabled()) {
if ($can_edit) {
$this->content->text = get_string('completionnotenabledforcourse', 'completion');
$this->content->text .= get_string('completionnotenabledforcourse', 'completion');
}
return $this->content;
}
@ -84,7 +86,7 @@ class block_completionstatus extends block_base {
// Check if this course has any criteria.
if (empty($completions)) {
if ($can_edit) {
$this->content->text = get_string('nocriteriaset', 'completion');
$this->content->text .= get_string('nocriteriaset', 'completion');
}
return $this->content;
}
@ -230,11 +232,11 @@ class block_completionstatus extends block_base {
$rows = array_merge($rows, $srows);
$table->data = $rows;
$this->content->text = html_writer::table($table);
$this->content->text .= html_writer::table($table);
// Display link to detailed view.
$details = new moodle_url('/blocks/completionstatus/details.php', array('course' => $course->id));
$this->content->footer = html_writer::link($details, get_string('moredetails', 'completion'));
$this->content->footer .= html_writer::link($details, get_string('moredetails', 'completion'));
} else {
// If user is not enrolled, show error.
$this->content->text = get_string('nottracked', 'completion');