Skip to content

Commit

Permalink
CONTRIB-6393 block_progress: Show message in the Dashboard when user …
Browse files Browse the repository at this point in the history
…is not enrolled in any courses
  • Loading branch information
Michael de Raadt committed Jun 18, 2016
1 parent 8eabcfa commit bb1154a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions block_progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public function get_content() {
AND bi.parentcontextid = :contextid
ORDER BY region, weight, bi.id";

// Show a message when the user is not enrolled in any courses.
if (($this->page->user_is_editing() || is_siteadmin()) && empty($courses)) {
$this->content->text = get_string('no_courses', 'block_progress');
return $this->content;
}

foreach ($courses as $courseid => $course) {

// Get specific block config and context.
Expand Down
1 change: 1 addition & 0 deletions lang/en/block_progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,4 @@

// For My home page.
$string['no_blocks'] = "No Progress Bar blocks are set up for your courses.";
$string['no_courses'] = "You are not enrolled in any courses. Only bars from enrolled courses will be shown.";
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$plugin->version = 2016061800;
$plugin->version = 2016061801;
$plugin->requires = 2010121000;
$plugin->maturity = MATURITY_STABLE;
$plugin->release = 'Version for Moodle 2.0 onwards';
Expand Down

0 comments on commit bb1154a

Please sign in to comment.