Skip to content
Snippets Groups Projects
Commit 20498607 authored by Matt Petro's avatar Matt Petro
Browse files

UWMOODLE-531 block course_overview_uwmoodle: Fixes for 2.6 compatibility

parent 479412ec
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,16 @@ defined('MOODLE_INTERNAL') || die;
function block_course_overview_uwmoodle_get_overviews($courses) {
$htmlarray = array();
if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
foreach ($modules as $fname) {
try {
$fname($courses,$htmlarray);
} catch (Exception $e) {
// Log the error message, and otherwise ignore the error
error_log("course_overview_uwmoodle: Error in getting overviews. ". $e->getMessage());
// Split courses list into batches with no more than MAX_MODINFO_CACHE_SIZE courses in one batch.
// Otherwise we exceed the cache limit in get_fast_modinfo() and rebuild it too often.
if (defined('MAX_MODINFO_CACHE_SIZE') && MAX_MODINFO_CACHE_SIZE > 0 && count($courses) > MAX_MODINFO_CACHE_SIZE) {
$batches = array_chunk($courses, MAX_MODINFO_CACHE_SIZE, true);
} else {
$batches = array($courses);
}
foreach ($batches as $courses) {
foreach ($modules as $fname) {
$fname($courses, $htmlarray);
}
}
}
......@@ -101,7 +105,7 @@ function block_course_overview_uwmoodle_get_child_shortnames($courseid) {
function block_course_overview_uwmoodle_get_sorted_courses() {
global $USER;
$courses = enrol_get_my_courses('id, shortname, fullname, modinfo, sectioncache', 'fullname', 0);
$courses = enrol_get_my_courses(null, 'fullname', 0);
$site = get_site();
if (array_key_exists($site->id,$courses)) {
......
......@@ -118,6 +118,7 @@
visibility:hidden;
position: absolute;
left: -9999px;
display: initial;
}
#uwmm_mycourses_block .courselistcontainer {
......
......@@ -19,8 +19,8 @@ defined('MOODLE_INTERNAL') || die();
$plugin->component = 'block_course_overview_uwmoodle';
$plugin->version = 2013071801;
$plugin->release = '1.1';
$plugin->requires = 2012062500;
$plugin->release = '1.2';
$plugin->requires = 2013111802;
$plugin->maturity = MATURITY_RC;
$plugin->cron = 43200; // Set min time between cron executions to 12 hours
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment