Skip to content

Commit

Permalink
MDL-30910: Lesson Module: fix lesson progress bar for screen readers
Browse files Browse the repository at this point in the history
AMOS BEGIN
   CPY [progresscompleted, mod_lesson]
AMOS END
  • Loading branch information
Rossiani Wijaya committed Feb 21, 2012
1 parent e0d5a17 commit dbac1a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
1 change: 1 addition & 0 deletions mod/lesson/lang/en/lesson.php
Expand Up @@ -338,6 +338,7 @@
$string['processerror'] = 'Error occurred during processing!'; $string['processerror'] = 'Error occurred during processing!';
$string['progressbar'] = 'Progress bar'; $string['progressbar'] = 'Progress bar';
$string['progressbar_help'] = 'If enabled, a bar is displayed at the bottom of lesson pages showing approximate percentage of completion.'; $string['progressbar_help'] = 'If enabled, a bar is displayed at the bottom of lesson pages showing approximate percentage of completion.';
$string['progresscompleted'] = 'You have completed {$a}% of the lesson';
$string['progressbarteacherwarning'] = 'Progress bar does not display for {$a}'; $string['progressbarteacherwarning'] = 'Progress bar does not display for {$a}';
$string['progressbarteacherwarning2'] = 'You will not see the progress bar because you can edit this lesson'; $string['progressbarteacherwarning2'] = 'You will not see the progress bar because you can edit this lesson';
$string['qtype'] = 'Page type'; $string['qtype'] = 'Page type';
Expand Down
16 changes: 3 additions & 13 deletions mod/lesson/renderer.php
Expand Up @@ -539,20 +539,10 @@ public function progress_bar(lesson $lesson) {
} }


// print out the Progress Bar. Attempted to put as much as possible in the style sheets. // print out the Progress Bar. Attempted to put as much as possible in the style sheets.
$cells = array(); $content = '<br />' . html_writer::tag('div', $progress . '%', array('class' => 'progress_bar_completed', 'style' => 'width: '. $progress . '%;'));
if ($progress != 0) { // some browsers do not repsect the 0 width. $printprogress = html_writer::tag('div', get_string('progresscompleted', 'lesson', $progress) . $content, array('class' => 'progress_bar'));
$cells[0] = new html_table_cell();
$cells[0]->style = 'width:'.$progress.'%';
$cells[0]->attributes['class'] = 'progress_bar_completed';
$cells[0]->text = ' ';
}
$cells[] = '<div class="progress_bar_token"></div>';

$table = new html_table();
$table->attributes['class'] = 'progress_bar_table';
$table->data = array(new html_table_row($cells));


return $this->output->box(html_writer::table($table), 'progress_bar'); return $this->output->box($printprogress, 'progress_bar');
} }


/** /**
Expand Down
1 change: 1 addition & 0 deletions mod/lesson/styles.css
Expand Up @@ -22,6 +22,7 @@
.path-mod-lesson .progress_bar_todo {padding: 0;margin: 0;} .path-mod-lesson .progress_bar_todo {padding: 0;margin: 0;}
.path-mod-lesson .progress_bar_token {height: 20px;width: 5px;padding: 0;margin: 0;} .path-mod-lesson .progress_bar_token {height: 20px;width: 5px;padding: 0;margin: 0;}
.path-mod-lesson .edit_pages_box .addlinks {margin:0;margin-bottom:1em;} .path-mod-lesson .edit_pages_box .addlinks {margin:0;margin-bottom:1em;}
.path-mod-lesson .progress_bar_completed {background-color:green; text-align:right; vertical-align:middle; color:#FFF;}


.path-mod-lesson .resourcecontent {text-align: center;} .path-mod-lesson .resourcecontent {text-align: center;}


Expand Down

0 comments on commit dbac1a5

Please sign in to comment.