diff --git a/course/search.php b/course/search.php index 7ea4aa224b8..4e365ffd45d 100644 --- a/course/search.php +++ b/course/search.php @@ -63,6 +63,11 @@ $USER->editing = $edit; } $adminediting = $PAGE->user_is_editing(); + + // Set perpage if user can edit in category + if ($perpage != 99999) { + $perpage = 30; + } } else { $adminediting = false; } @@ -84,10 +89,6 @@ } } - if (has_any_capability($capabilities, get_context_instance(CONTEXT_SYSTEM)) && ($perpage != 99999)) { - $perpage = 30; - } - $displaylist = array(); $parentlist = array(); make_categories_list($displaylist, $parentlist); @@ -137,10 +138,10 @@ if (preg_match('/^c\d+$/', $key)) { $courseid = substr($key, 1); // user must have category:manage and course:create capability for the course to be moved. - if (has_all_capabilities($capabilities, get_context_instance(CONTEXT_COURSE, $courseid))) { + $coursecontext = get_context_instance(CONTEXT_COURSE, $courseid); + foreach ($capabilities as $capability) { + require_capability($capability, $coursecontext); array_push($courses, $courseid); - } else { - print_error('cannotmovecoursetocategory'); } } } @@ -251,11 +252,16 @@ echo $OUTPUT->spacer(array('height'=>5, 'width'=>5, 'br'=>true)); // should be done with CSS instead } } else { //editing mode - echo "