Commit e0140f24 authored by patrickslee's avatar patrickslee
Browse files

Revised front page logic so list of courses and list of categories show...

Revised front page logic so list of courses and list of categories show correct things regardless of any special situation

And a small HTML fix for print_category_info()
parent 6298f98c
......@@ -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.'">';
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment