Permalink
Browse files

MDL-20459 - update list of categories layout to support accessibility…

…. Convert table to CSS.
  • Loading branch information...
1 parent 30bee9e commit cb184beb24cc59fa7e3c01f3cba7199c7d8b93f1 Rossiani Wijaya committed Jul 23, 2010
Showing with 26 additions and 29 deletions.
  1. +17 −27 course/lib.php
  2. +1 −0 lang/en/moodle.php
  3. +8 −2 theme/base/style/course.css
View
@@ -1421,7 +1421,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
// We may be displaying this just in order to show information
- // about visibility, without the actual link
+ // about visibility, without the actual link
if ($mod->uservisible) {
// Display normal module link
if (!$accessiblebutdim) {
@@ -2023,12 +2023,10 @@ function print_category_info($category, $depth, $showcourses = false) {
} else {
$catimage = " ";
}
-
- echo "\n\n".'<table class="categorylist">';
-
+
$courses = get_courses($category->id, 'c.sortorder ASC', 'c.id,c.sortorder,c.visible,c.fullname,c.shortname,c.summary');
if ($showcourses and $coursecount) {
-
+ echo "\n\n".'<table class="categorylist">';
echo '<tr>';
if ($depth) {
@@ -2038,7 +2036,7 @@ function print_category_info($category, $depth, $showcourses = false) {
echo $OUTPUT->spacer(array('height'=>10, 'width'=>$indent, 'br'=>true)); // should be done with CSS instead
echo '</td>';
- }
+ }
echo '<td valign="top" class="category image">'.$catimage.'</td>';
echo '<td valign="top" class="category name">';
@@ -2048,13 +2046,13 @@ function print_category_info($category, $depth, $showcourses = false) {
echo '</tr>';
// does the depth exceed maxcategorydepth
- // maxcategorydepth == 0 or unset meant no limit
+ // maxcategorydepth == 0 or unset meant no limit
$limit = !(isset($CFG->maxcategorydepth) && ($depth >= $CFG->maxcategorydepth-1));
if ($courses && ($limit || $CFG->maxcategorydepth == 0)) {
foreach ($courses as $course) {
- $linkcss = $course->visible ? '' : ' class="dimmed" ';
+ $linkcss = $course->visible ? '' : ' class="dimmed" ';
echo '<tr><td valign="top">&nbsp;';
echo '</td><td valign="top" class="course name">';
echo '<a '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'. format_string($course->fullname).'</a>';
@@ -2069,29 +2067,21 @@ function print_category_info($category, $depth, $showcourses = false) {
echo '<img alt="" style="width:18px;height:16px;" src="'.$OUTPUT->pix_url('spacer') . '" />';
}
echo '</td></tr>';
- }
+ }
}
- } else {
-
- echo '<tr>';
-
+ echo '</table>';
+ } else {
+ echo '<div class="categorylist">';
+ echo '<div class="category">';
if ($depth) {
$indent = $depth*20;
- echo '<td class="category indentation" valign="top">';
- echo $OUTPUT->spacer(array('height'=>10, 'width'=>$indent, 'br'=>true)); // should be done with CSS instead
- echo '</td>';
+ echo $OUTPUT->spacer(array('height'=>10, 'width'=>$indent, 'br'=>true)); // should be done with CSS instead
}
-
- echo '<td valign="top" class="category name">';
- echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'. format_string($category->name).'</a>';
- echo '</td>';
- echo '<td valign="top" class="category number">';
- if (count($courses)) {
- echo count($courses);
- }
- echo '</td></tr>';
- }
- echo '</table>';
+ echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'. format_string($category->name).'</a>';
+ echo '<span class="numberofcourse" title="' .get_string('numberofcourses') . '"> ('.count($courses).')</span>';
+ echo '</div>';
+ echo '</div>';
+ }
}
/**
View
@@ -1185,6 +1185,7 @@
$string['novalidcourses'] = 'No valid courses to be shown';
$string['now'] = 'now';
$string['numattempts'] = '{$a} failed login attempt(s)';
+$string['numberofcourses'] = 'Number of courses';
$string['numberweeks'] = 'Number of weeks/topics';
$string['numdays'] = '{$a} days';
$string['numhours'] = '{$a} hours';
@@ -76,6 +76,8 @@
.categorylist .category.image {width: 20px;}
.categorylist .category.number {text-align: right;}
.categorylist .category.indentation {width: 1px;}
+.categorylist .category .numberofcourse {font-style: italic; font-size: 0.85em; font-style: normal;}
+.categorylist .category {padding-top: 5px; padding-bottom: 5px; }
.path-course-report-outline td.numviews {text-align:right;}
.path-course-report-outline tr.section {text-align: center;}
@@ -104,11 +106,15 @@
.jsenabled .course_category_tree .category.with_children.collapsed .subcategories,
.jsenabled .course_category_tree .category.with_children.collapsed .courses {display:none;}
-/** Overide for RTL layout **/
+.path-course .clearfloat {float:none; clear:both;height:0px;}
+
+/**
+* Overide for RTL layout
+*/
.dir-rtl .coursebox .info {float: right; text-align: right;}
.dir-rtl .coursebox .summary {text-align:right;}
.dir-rtl .course_category_tree .category.with_children> .category_label {background-position: center right; padding-right: 18px;}
.dir-rtl .course_category_tree .category_label, .dir-rtl .course_category_tree .category .course {padding-right:18px;}
.dir-rtl.jsenabled .course_category_tree .category.with_children.collapsed .category_label {background-image:url([[pix:moodle|t/collapsed_rtl]]);}
.dir-rtl .course_category_tree .category .courses .course_link {background-position:center right; padding-right:18px;}
-.dir-rtl .clearfloat {float:none; clear:both;height:0px;}
+.dir-rtl .clearfloat {float:none; clear:both;height:0px;}

0 comments on commit cb184be

Please sign in to comment.