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 ...@@ -171,11 +171,16 @@ class Admin_CoursesController extends AuthenticatedController
Now draw the configurable elements according Now draw the configurable elements according
to the values inside the visibleElements array. to the values inside the visibleElements array.
*/ */
$institute_id = null;
if (!empty($visibleElements['search'])) { if (!empty($visibleElements['search'])) {
$this->setSearchWiget(); $this->setSearchWiget();
} }
if (!empty($visibleElements['institute'])) { 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'])) { if (!empty($visibleElements['semester'])) {
$filter->addElement($this->getSemesterSelector()); $filter->addElement($this->getSemesterSelector());
...@@ -187,7 +192,7 @@ class Admin_CoursesController extends AuthenticatedController ...@@ -187,7 +192,7 @@ class Admin_CoursesController extends AuthenticatedController
$filter->addElement($this->getCourseTypeWidget()); $filter->addElement($this->getCourseTypeWidget());
} }
if (!empty($visibleElements['teacher'])) { if (!empty($visibleElements['teacher'])) {
$filter->addElement($this->getTeacherWidget()); $filter->addElement($this->getTeacherWidget($institute_id));
} }
$sidebar->addWidget($filter, 'filter'); $sidebar->addWidget($filter, 'filter');
......
...@@ -30,6 +30,11 @@ class SelectListElement extends WidgetElement implements ArrayAccess ...@@ -30,6 +30,11 @@ class SelectListElement extends WidgetElement implements ArrayAccess
$this->options = $options; $this->options = $options;
} }
public function getOptions(): array
{
return $this->options;
}
public function render() public function render()
{ {
$option_content = ''; $option_content = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment