Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
authored January 30, 2006

Showing 2 changed files with 15 additions and 17 deletions. Show diff stats Hide diff stats

  1. 6  course/lib.php
  2. 26  index.php
6  course/lib.php
@@ -1292,7 +1292,7 @@ function print_category_info($category, $depth) {
1292 1292
 
1293 1293
     $frontpage = explode(',', $CFG->frontpage);
1294 1294
     $frontpage = $frontpage?array_flip($frontpage):array();
1295  
-    if (isset($frontpage[FRONTPAGECOURSELIST])) {
  1295
+    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
1296 1296
         $catimage = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
1297 1297
     } else {
1298 1298
         $catimage = "&nbsp;";
@@ -1300,7 +1300,7 @@ function print_category_info($category, $depth) {
1300 1300
 
1301 1301
     echo "\n\n".'<table border="0" cellpadding="3" cellspacing="0" width="100%">';
1302 1302
 
1303  
-    if (isset($frontpage[FRONTPAGECOURSELIST])) {
  1303
+    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
1304 1304
         $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');
1305 1305
 
1306 1306
         echo "<tr>";
@@ -1351,6 +1351,8 @@ function print_category_info($category, $depth) {
1351 1351
         }
1352 1352
     } else {
1353 1353
 
  1354
+        echo '<tr>';
  1355
+
1354 1356
         if ($depth) {
1355 1357
             $indent = $depth*20;
1356 1358
             echo '<td valign="top" width="'.$indent.'">';
26  index.php
@@ -150,29 +150,25 @@
150 150
             break;
151 151
 
152 152
             case FRONTPAGECOURSELIST:
153  
-            case FRONTPAGECATEGORYNAMES:
154 153
 
155 154
                 if (isloggedin() && !isset($USER->admin) && empty($CFG->disablemycourses)) {
156 155
                     print_heading_block(get_string('mycourses'));
157 156
                     print_my_moodle();
158 157
                 } else {
159  
-                    if (count_records('course_categories') > 1) {
160  
-                        if ($v == FRONTPAGECOURSELIST) {
161  
-                            print_heading_block(get_string('availablecourses'));
162  
-                        } else {
163  
-                            print_heading_block(get_string('categories'));
164  
-                        }
165  
-                        print_simple_box_start('center', '100%', '', 5, 'categorybox');
166  
-                        print_whole_category_list();
167  
-                        print_simple_box_end();
168  
-                        print_course_search('', false, 'short');
169  
-                    } else {
170  
-                        print_heading_block(get_string('availablecourses'));
171  
-                        print_courses(0, '100%');
172  
-                    }
  158
+                    print_heading_block(get_string('availablecourses'));
  159
+                    print_courses(0, '100%');
173 160
                 }
174 161
             break;
175 162
 
  163
+            case FRONTPAGECATEGORYNAMES:
  164
+
  165
+                print_heading_block(get_string('categories'));
  166
+                print_simple_box_start('center', '100%', '', 5, 'categorybox');
  167
+                print_whole_category_list();
  168
+                print_simple_box_end();
  169
+                print_course_search('', false, 'short');
  170
+            break;
  171
+
176 172
             case FRONTPAGETOPICONLY:    // Do nothing!!  :-)
177 173
             break;
178 174
 

0 notes on commit e0140f2

Please sign in to comment.
Something went wrong with that request. Please try again.