MDL-39305 fixed display bugs in course listings

- When category has a lot of subcategories and courses and user clicks 'view more' for categories, the courses are still displayed
- Course summary non-image files may appear above course summary image files, and they don't have an icon with the filetype
This commit is contained in:
Marina Glancy 2013-04-23 18:57:21 +10:00
parent 3a8c4380c0
commit 545b3930f8

View file

@ -1127,21 +1127,26 @@ class core_course_renderer extends plugin_renderer_base {
}
// display course overview files
$contentimages = $contentfiles = '';
foreach ($course->get_course_overviewfiles() as $file) {
$isimage = $file->is_valid_image();
$url = file_encode_url("$CFG->wwwroot/pluginfile.php",
'/'. $file->get_contextid(). '/'. $file->get_component(). '/'.
$file->get_filearea(). $file->get_filepath(). $file->get_filename(), !$isimage);
if ($isimage) {
$content .= html_writer::tag('div',
$contentimages .= html_writer::tag('div',
html_writer::empty_tag('img', array('src' => $url)),
array('class' => 'courseimage'));
} else {
$content .= html_writer::tag('div',
html_writer::link($url, $file->get_filename()),
array('class' => 'coursefile'));
$image = $this->output->pix_icon(file_file_icon($file, 24), $file->get_filename(), 'moodle');
$filename = html_writer::tag('span', $image, array('class' => 'fp-icon')).
html_writer::tag('span', $file->get_filename(), array('class' => 'fp-filename'));
$contentfiles .= html_writer::tag('span',
html_writer::link($url, $filename),
array('class' => 'coursefile fp-filename-icon'));
}
}
$content .= $contentimages. $contentfiles;
// display course contacts. See course_in_list::get_course_contacts()
if ($course->has_course_contacts()) {
@ -1360,7 +1365,10 @@ class core_course_renderer extends plugin_renderer_base {
// Courses
if ($chelper->get_show_courses() > core_course_renderer::COURSECAT_SHOW_COURSES_COUNT) {
$courses = $coursecat->get_courses($chelper->get_courses_display_options());
$courses = array();
if (!$chelper->get_courses_display_option('nodisplay')) {
$courses = $coursecat->get_courses($chelper->get_courses_display_options());
}
if ($viewmoreurl = $chelper->get_courses_display_option('viewmoreurl')) {
// the option for 'View more' link was specified, display more link (if it is link to category view page, add category id)
if ($viewmoreurl->compare(new moodle_url('/course/index.php'), URL_MATCH_BASE)) {