I expanded the list navmenulist for better handling with:

_ a header
_ spans for the section titles

It's still work in progress
This commit is contained in:
urs_hunkler 2005-03-29 21:08:17 +00:00
parent a5c5a1807f
commit 143211e5da

View File

@ -3132,7 +3132,7 @@ function navmenu($course, $cm=NULL, $targetwindow='self') {
$sections = get_records('course_sections','course',$course->id,'section','section,visible,summary');
if (!empty($THEME->makenavmenulist)) { /// A hack to produce an XHTML navmenu list for use in themes
$THEME->navmenulist = navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $width=50, $cm);
$THEME->navmenulist = navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $width, $cm);
}
foreach ($modinfo as $mod) {
@ -3241,7 +3241,7 @@ function navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $wid
$flag = false;
$menu = array();
$menu[] = '<ul>';
$menu[] = '<ul class="floatnav"><li><span class="list-title section">Direkt zu...</span><ul>';
foreach ($modinfo as $mod) {
if ($mod->mod == 'label') {
continue;
@ -3251,7 +3251,7 @@ function navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $wid
break;
}
if ($mod->section > 0 and $section <> $mod->section) {
if ($mod->section >= 0 and $section <> $mod->section) {
$thissection = $sections[$mod->section];
if ($thissection->visible or !$course->hiddensections or $isteacher) {
@ -3260,12 +3260,12 @@ function navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $wid
$menu[] = '</ul></li>';
}
if ($course->format == 'weeks' or empty($thissection->summary)) {
$menu[] = '<li>'. $strsection ." ". $mod->section;
$menu[] = '<li><span class="section">'. $strsection ." ". $mod->section . '</span>';
} else {
if (strlen($thissection->summary) < ($width-3)) {
$menu[] = '<li>'.$thissection->summary;
$menu[] = '<li><span class="section">'.$thissection->summary . '</span>';
} else {
$menu[] = '<li>'.substr($thissection->summary, 0, $width).'...';
$menu[] = '<li><span class="section">'.substr($thissection->summary, 0, $width).'...' . '</span>';
}
}
$menu[] = '<ul>';
@ -3297,7 +3297,7 @@ function navmenulist($course, $sections, $modinfo, $isteacher, $strsection, $wid
if ($doneheading) {
$menu[] = '</ul></li>';
}
$menu[] = '</ul>';
$menu[] = '</ul></li></ul>';
return implode("\n", $menu);
}