diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2024-04-30 11:25:35 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-04-30 11:25:35 +0000 |
| commit | 4711c82b887a0629acf53352981f3badbbce8ba7 (patch) | |
| tree | 7de8129cf25a17c4595c95e35f969d5d01b053ec /app/controllers/questionnaire.php | |
| parent | 0d766d2f811526fb7071130fdba895000528f5ed (diff) | |
prevent php-warnings, fixes #4098
Closes #4098
Merge request studip/studip!2944
Diffstat (limited to 'app/controllers/questionnaire.php')
| -rw-r--r-- | app/controllers/questionnaire.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/questionnaire.php b/app/controllers/questionnaire.php index fe2ed3a..6f80526 100644 --- a/app/controllers/questionnaire.php +++ b/app/controllers/questionnaire.php @@ -48,6 +48,10 @@ class QuestionnaireController extends AuthenticatedController public function courseoverview_action() { $this->range_id = Context::getId(); + + if (!$this->range_id) { + throw new CheckObjectException(_('Sie haben kein Objekt gewählt.')); + } $this->range_type = Context::getType(); if (!$GLOBALS['perm']->have_studip_perm("tutor", $this->range_id)) { throw new AccessDeniedException("Only for logged in users."); @@ -593,8 +597,8 @@ class QuestionnaireController extends AuthenticatedController } $this->statusgruppen_ids = []; if (in_array($this->range_type, ["course", "institute"])) { - if ($GLOBALS['perm']->have_studip_perm("tutor", $this->range_id)) { - $statusgruppen = Statusgruppen::findByRange_id(Context::get()->id); + if ($this->range_id && $GLOBALS['perm']->have_studip_perm("tutor", $this->range_id)) { + $statusgruppen = Statusgruppen::findByRange_id($this->range_id); } else { $statusgruppen = Statusgruppen::findBySQL("INNER JOIN statusgruppe_user USING (statusgruppe_id) WHERE statusgruppen.range_id = ? AND statusgruppe_user.user_id = ? ", [ Context::get()->id, @@ -643,6 +647,7 @@ class QuestionnaireController extends AuthenticatedController object_set_visit($questionnaire['questionnaire_id'], 'vote'); } if (in_array($this->range_type, ["course", "institute"]) + && $this->range_id && !$GLOBALS['perm']->have_studip_perm("tutor", $this->range_id) && !($stopped_visible || count($this->questionnaire_data))) { $this->render_nothing(); |
