$c = make_context_subobj($c);
if (has_capability_in_accessdata($cap, $c->context, $accessdata, $doanything)) {
- $courses[] = $c;
- if ($limit > 0 && $cc++ > $limit) {
+ if ($limit > 0 && $cc >= $limit) {
break;
}
+
+ $courses[] = $c;
+ $cc++;
}
}
$rs->close();
// build the context obj
$c = make_context_subobj($c);
- $courses[$c->id] = $c;
- if ($limit > 0 && $cc++ > $limit) {
+ if ($limit > 0 && $cc >= $limit) {
break;
}
+
+ $courses[$c->id] = $c;
+ $cc++;
}
$rs->close();
return $courses;