aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/module
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2022-10-11 08:20:50 +0000
committerMoritz Strohm <strohm@data-quest.de>2022-10-11 08:20:50 +0000
commit48a46a46b90b4909d8fd44b7bb318d0468085a75 (patch)
treec70fdb04e81b257078fdcc23e95369ac040fa681 /app/controllers/module
parent63bb3157e9e881043a9504aa4ecef91acbed1ce5 (diff)
fix for BIESt 1127, closes #1127
Closes #1127 Merge request studip/studip!677
Diffstat (limited to 'app/controllers/module')
-rw-r--r--app/controllers/module/institute.php2
-rw-r--r--app/controllers/module/module.php18
-rw-r--r--app/controllers/module/mvv_controller.php7
3 files changed, 19 insertions, 8 deletions
diff --git a/app/controllers/module/institute.php b/app/controllers/module/institute.php
index 0572640..5ac67fd 100644
--- a/app/controllers/module/institute.php
+++ b/app/controllers/module/institute.php
@@ -16,6 +16,8 @@ class Module_InstituteController extends Module_ModuleController
parent::before_filter($action, $args);
URLHelper::bindLinkParam('institut_id', $this->institut_id);
+ $this->inst_id = '';
+
if (Request::isXhr()) {
$this->set_layout(null);
}
diff --git a/app/controllers/module/module.php b/app/controllers/module/module.php
index c936fee..74415ba 100644
--- a/app/controllers/module/module.php
+++ b/app/controllers/module/module.php
@@ -20,6 +20,9 @@ class Module_ModuleController extends MVVController
Navigation::activateItem($this->me . '/module/module');
$this->filter = $this->sessGet('filter', []);
$this->action = $action;
+ $this->modul_id = '';
+ $this->details_url = '';
+ $this->modulteil_id = '';
PageLayout::addSqueezePackage('statusgroups');
}
@@ -44,7 +47,7 @@ class Module_ModuleController extends MVVController
// Nur Module von verantwortlichen Einrichtungen an denen der User
// eine Rolle hat
- if (!$this->filter['mvv_modul_inst.institut_id']) {
+ if (empty($this->filter['mvv_modul_inst.institut_id'])) {
unset($this->filter['mvv_modul_inst.institut_id']);
}
$this->filter = array_merge(
@@ -1343,7 +1346,7 @@ class Module_ModuleController extends MVVController
{
// Nur Module von verantwortlichen Einrichtungen an denen der User
// eine Rolle hat
- if (!$this->filter['mvv_modul_inst.institut_id']) {
+ if (empty($this->filter['mvv_modul_inst.institut_id'])) {
unset($this->filter['mvv_modul_inst.institut_id']);
}
$modul_filter = array_merge(
@@ -1360,22 +1363,25 @@ class Module_ModuleController extends MVVController
// Status
$modul_ids = Modul::findByFilter($modul_filter);
$template->set_attribute('status', Modul::findStatusByIds($modul_ids));
- $template->set_attribute('selected_status', $this->filter['mvv_modul.stat']);
+ $template->set_attribute('selected_status', $this->filter['mvv_modul.stat'] ?? '');
$template->set_attribute('status_array', $GLOBALS['MVV_MODUL']['STATUS']['values']);
// Institutes
$template->set_attribute('institute', Modul::getAllAssignedInstitutes('name', 'ASC', $modul_filter));
$template->set_attribute('institute_count', 'count_objects');
- $template->set_attribute('selected_institut', $this->filter['mvv_modul_inst.institut_id']);
+ $template->set_attribute('selected_institut', $this->filter['mvv_modul_inst.institut_id'] ?? '');
// Semesters
$semesters = new SimpleCollection(Semester::getAll());
$semesters = $semesters->orderBy('beginn desc');
- $selected_semester = $semesters->findOneBy('beginn', $this->filter['start_sem.beginn']);
+ $selected_semester = null;
+ if (!empty($this->filter['start_sem.beginn'])) {
+ $selected_semester = $semesters->findOneBy('beginn', $this->filter['start_sem.beginn']);
+ }
$template->set_attribute('semester', $semesters);
- $template->set_attribute('selected_semester', $selected_semester->id);
+ $template->set_attribute('selected_semester', $selected_semester->id ?? '');
$template->set_attribute('default_semester', Semester::findCurrent()->id);
$template->set_attribute('action', $this->set_filterURL());
diff --git a/app/controllers/module/mvv_controller.php b/app/controllers/module/mvv_controller.php
index f54d8cf..e84b37c 100644
--- a/app/controllers/module/mvv_controller.php
+++ b/app/controllers/module/mvv_controller.php
@@ -67,6 +67,9 @@ abstract class MVVController extends AuthenticatedController
{
parent::before_filter($action, $args);
+ $this->sortby = '';
+ $this->page_params_suffix = '';
+
if (!static::IsVisible()) {
throw new AccessDeniedException();
}
@@ -204,7 +207,7 @@ abstract class MVVController extends AuthenticatedController
0, -10)) . '/';
}
$to = $this->url_for($to);
- list($url, $query) = explode('?', $to);
+ $url = explode('?', $to)[0];
$url = URLHelper::getUrl($url, $params, true);
$template = $this->get_template_factory()->open('shared/js_url');
$template->set_attributes(['url' => $url]);
@@ -308,7 +311,7 @@ abstract class MVVController extends AuthenticatedController
}
} else {
$search_term = $search_term ?: $this->search_term;
- $filter = $filter ?: $this->filter;
+ $filter = $filter ?? [];
if ($search_term) {
$this->search_result =
$class_name::findBySearchTerm($search_term, $filter)->pluck('id');