MDL-75569 course: fix non-functional search bar in course index page
For users who are not allowed to access course/management.php, the normal course search is used instead.
This commit is contained in:
@@ -128,13 +128,18 @@ class manage_categories_action_bar implements \renderable {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_search_form(): array {
|
||||
return [
|
||||
'action' => new moodle_url('/course/management.php'),
|
||||
$searchform = [
|
||||
'btnclass' => 'btn-primary',
|
||||
'inputname' => 'search',
|
||||
'searchstring' => get_string('searchcourses'),
|
||||
'query' => $this->searchvalue
|
||||
];
|
||||
if (\core_course_category::has_capability_on_any(['moodle/category:manage', 'moodle/course:create'])) {
|
||||
$searchform['action'] = new moodle_url('/course/management.php');
|
||||
} else {
|
||||
$searchform['action'] = new moodle_url('/course/search.php');
|
||||
}
|
||||
return $searchform;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user