Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revised front page logic so list of courses and list of categories sh…

…ow correct things regardless of any special situation

And a small HTML fix for print_category_info()
  • Loading branch information...
commit e0140f2425aea26774cb77a099f9ade891f370f2 1 parent 6298f98
patrickslee authored
Showing with 15 additions and 17 deletions.
  1. +4 −2 course/lib.php
  2. +11 −15 index.php
View
6 course/lib.php
@@ -1292,7 +1292,7 @@ function print_category_info($category, $depth) {
$frontpage = explode(',', $CFG->frontpage);
$frontpage = $frontpage?array_flip($frontpage):array();
- if (isset($frontpage[FRONTPAGECOURSELIST])) {
+ if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
$catimage = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
} else {
$catimage = "&nbsp;";
@@ -1300,7 +1300,7 @@ function print_category_info($category, $depth) {
echo "\n\n".'<table border="0" cellpadding="3" cellspacing="0" width="100%">';
- if (isset($frontpage[FRONTPAGECOURSELIST])) {
+ if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
$courses = get_courses($category->id, 'c.sortorder ASC', 'c.id,c.sortorder,c.visible,c.fullname,c.shortname,c.password,c.summary,c.guest,c.cost,c.currency');
echo "<tr>";
@@ -1351,6 +1351,8 @@ function print_category_info($category, $depth) {
}
} else {
+ echo '<tr>';
+
if ($depth) {
$indent = $depth*20;
echo '<td valign="top" width="'.$indent.'">';
View
26 index.php
@@ -150,29 +150,25 @@
break;
case FRONTPAGECOURSELIST:
- case FRONTPAGECATEGORYNAMES:
if (isloggedin() && !isset($USER->admin) && empty($CFG->disablemycourses)) {
print_heading_block(get_string('mycourses'));
print_my_moodle();
} else {
- if (count_records('course_categories') > 1) {
- if ($v == FRONTPAGECOURSELIST) {
- print_heading_block(get_string('availablecourses'));
- } else {
- print_heading_block(get_string('categories'));
- }
- print_simple_box_start('center', '100%', '', 5, 'categorybox');
- print_whole_category_list();
- print_simple_box_end();
- print_course_search('', false, 'short');
- } else {
- print_heading_block(get_string('availablecourses'));
- print_courses(0, '100%');
- }
+ print_heading_block(get_string('availablecourses'));
+ print_courses(0, '100%');
}
break;
+ case FRONTPAGECATEGORYNAMES:
+
+ print_heading_block(get_string('categories'));
+ print_simple_box_start('center', '100%', '', 5, 'categorybox');
+ print_whole_category_list();
+ print_simple_box_end();
+ print_course_search('', false, 'short');
+ break;
+
case FRONTPAGETOPICONLY: // Do nothing!! :-)
break;
Please sign in to comment.
Something went wrong with that request. Please try again.