Skip to content
Permalink
Browse files

My Moodle: MDL-19089 Course limit for My Moodle not propperly obeyed.…

… Fixing so that it obeys mycoursesperpage and propperly displays '...'
  • Loading branch information...
ericmerrill
ericmerrill committed Oct 7, 2009
1 parent 39a631b commit a17fcb7b535af12dd8448d443c3a2272ffea9d5e
Showing with 15 additions and 2 deletions.
  1. +15 −2 my/index.php
@@ -64,13 +64,26 @@
/// The main overview in the middle of the page
$courses_limit = 21;
if (!empty($CFG->mycoursesperpage)) {
if (isset($CFG->mycoursesperpage)) {
$courses_limit = $CFG->mycoursesperpage;
}
$morecourses = false;
if ($courses_limit > 0) {
print "a";
$courses_limit = $courses_limit + 1;
}
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, $courses_limit);
$site = get_site();
$course = $site; //just in case we need the old global $course hack
if (($courses_limit > 0) && (count($courses) >= $courses_limit)) {
//remove the 'marker' course that we retrieve just to see if we have more than $courses_limit
array_pop($courses);
$morecourses = true;
}
if (array_key_exists($site->id,$courses)) {
unset($courses[$site->id]);
}
@@ -90,7 +103,7 @@
}
// if more than 20 courses
if (count($courses) > 20) {
if ($morecourses) {
echo '<br />...';
}

0 comments on commit a17fcb7

Please sign in to comment.
You can’t perform that action at this time.