Permalink
Browse files

MDL-33027 theme: Hidden section link will be displayed dimmed in sect…

…ion navigation
  • Loading branch information...
1 parent c129f43 commit bcf7175f4e50b01975a1b7d224dcfd04718d8434 Rajesh Taneja committed May 17, 2012
Showing with 22 additions and 5 deletions.
  1. +22 −5 course/format/renderer.php
@@ -261,10 +261,15 @@ protected function section_edit_controls($course, $section, $onsectionpage = fal
* @return string HTML to output.
*/
protected function section_summary($section, $course) {
+ // If section is hidden then display grey section link
+ $classattr = 'section-summary clearfix';
+ If (!$section->visible) {
+ $classattr .= ' dimmed_text';
+ }
$o = '';
$o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section,
- 'class' => 'section-summary clearfix'));
+ 'class' => $classattr));
$title = get_section_name($course, $section);
$o.= html_writer::start_tag('a', array('href' => course_get_url($course, $section->section)));
@@ -351,19 +356,27 @@ protected function get_nav_links($course, $sections, $sectionno) {
$back = $sectionno - 1;
while ($back > 0 and empty($links['previous'])) {
if ($canviewhidden || $sections[$back]->visible) {
+ $params = array();
+ if (!$sections[$back]->visible) {
+ $params = array('class' => 'dimmed_text');
+ }
$previouslink = html_writer::tag('span', $this->output->larrow(), array('class' => 'larrow'));
$previouslink .= get_section_name($course, $sections[$back]);
- $links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink);
+ $links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink, $params);
}
$back--;
}
$forward = $sectionno + 1;
while ($forward <= $course->numsections and empty($links['next'])) {
if ($canviewhidden || $sections[$forward]->visible) {
+ $params = array();
+ if (!$sections[$forward]->visible) {
+ $params = array('class' => 'dimmed_text');
+ }
$nextlink = get_section_name($course, $sections[$forward]);
$nextlink .= html_writer::tag('span', $this->output->rarrow(), array('class' => 'rarrow'));
- $links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink);
+ $links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink, $params);
}
$forward++;
}
@@ -444,7 +457,6 @@ public function print_single_section_page($course, $sections, $mods, $modnames,
echo $this->start_section_list();
echo $this->section_hidden($displaysection);
echo $this->end_section_list();
- echo $sectionnavlinks;
}
// Can't view this section.
return;
@@ -472,7 +484,12 @@ public function print_single_section_page($course, $sections, $mods, $modnames,
$sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
$sectiontitle .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
$sectiontitle .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
- $sectiontitle .= html_writer::tag('div', get_section_name($course, $sections[$displaysection]), array('class' => 'mdl-align title'));
+ // Title attributes
+ $titleattr = 'mdl-align title';
+ if (!$sections[$displaysection]->visible) {
+ $titleattr .= ' dimmed_text';
+ }
+ $sectiontitle .= html_writer::tag('div', get_section_name($course, $sections[$displaysection]), array('class' => $titleattr));
$sectiontitle .= html_writer::end_tag('div');
echo $sectiontitle;

0 comments on commit bcf7175

Please sign in to comment.