Skip to content
Snippets Groups Projects
Commit 0142b925 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

preselect only institute, fixes #4241

Closes #4241

Merge request studip/studip!3450
parent fb0eb32d
No related branches found
No related tags found
No related merge requests found
......@@ -171,11 +171,16 @@ class Admin_CoursesController extends AuthenticatedController
Now draw the configurable elements according
to the values inside the visibleElements array.
*/
$institute_id = null;
if (!empty($visibleElements['search'])) {
$this->setSearchWiget();
}
if (!empty($visibleElements['institute'])) {
$filter->addElement($this->getInstSelector());
$inst_selector = $filter->addElement($this->getInstSelector());
if (count($inst_selector->getOptions()) === 1) {
$institute_id = $this->insts[0]['Institut_id'];
}
}
if (!empty($visibleElements['semester'])) {
$filter->addElement($this->getSemesterSelector());
......@@ -187,7 +192,7 @@ class Admin_CoursesController extends AuthenticatedController
$filter->addElement($this->getCourseTypeWidget());
}
if (!empty($visibleElements['teacher'])) {
$filter->addElement($this->getTeacherWidget());
$filter->addElement($this->getTeacherWidget($institute_id));
}
$sidebar->addWidget($filter, 'filter');
......
......@@ -30,6 +30,11 @@ class SelectListElement extends WidgetElement implements ArrayAccess
$this->options = $options;
}
public function getOptions(): array
{
return $this->options;
}
public function render()
{
$option_content = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment