MDL-26190 completion blocks: Show messages rather than hiding the block
authorAaron Barnes <aaronb@catalyst.net.nz>
Thu, 17 Feb 2011 03:56:26 +0000 (16:56 +1300)
committerAaron Barnes <aaronb@catalyst.net.nz>
Wed, 2 Mar 2011 03:34:19 +0000 (16:34 +1300)
blocks/completionstatus/block_completionstatus.php
blocks/selfcompletion/block_selfcompletion.php
blocks/selfcompletion/lang/en/block_selfcompletion.php

index 7a8e17b..0d7d104 100644 (file)
@@ -49,6 +49,7 @@ class block_completionstatus extends block_base {
 
         // Don't display if completion isn't enabled!
         if (!$this->page->course->enablecompletion) {
+            $this->content->text = get_string('completionnotenabled', 'block_completionstatus');
             return $this->content;
         }
 
@@ -58,6 +59,7 @@ class block_completionstatus extends block_base {
 
         // Check if this course has any criteria
         if (empty($completions)) {
+            $this->content->text = get_string('nocriteria', 'block_completionstatus');
             return $this->content;
         }
 
@@ -157,7 +159,7 @@ class block_completionstatus extends block_base {
 
         // Is course complete?
         $coursecomplete = $info->is_course_complete($USER->id);
-               
+
         // Load course completion
         $params = array(
             'userid' => $USER->id,
index f08eef5..a5a7da9 100644 (file)
@@ -54,6 +54,7 @@ class block_selfcompletion extends block_base {
 
         // Don't display if completion isn't enabled!
         if (!$this->page->course->enablecompletion) {
+            $this->content->text = get_string('completionnotenabled', 'block_selfcompletion');
             return $this->content;
         }
 
@@ -68,6 +69,7 @@ class block_selfcompletion extends block_base {
 
         // Check if self completion is one of this course's criteria
         if (empty($completion)) {
+            $this->content->text = get_string('selfcompletionnotenabled', 'block_selfcompletion');
             return $this->content;
         }
 
index 7b066a1..45775d8 100644 (file)
@@ -26,3 +26,5 @@
 $string['selfcompletion'] = 'Self completion';
 $string['pluginname'] = 'Self completion';
 $string['completecourse'] = 'Complete course';
+$string['completionnotenabled'] = 'Course completion is not enabled';
+$string['selfcompletionnotenabled'] = 'The self completion criteria has not been enabled for this course';