Skip to content

Commit

Permalink
MDL-20459 - update list of categories layout to support accessibility…
Browse files Browse the repository at this point in the history
…. Convert table to CSS.
  • Loading branch information
rwijaya committed Jul 23, 2010
1 parent 30bee9e commit cb184be
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
44 changes: 17 additions & 27 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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">';
Expand All @@ -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>';
Expand All @@ -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>';
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
10 changes: 8 additions & 2 deletions theme/base/style/course.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down Expand Up @@ -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.