diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2023-03-07 09:17:45 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2023-03-07 09:17:45 +0000 |
| commit | 28ea07fbef7454a65ec0e0fda35e9e0844f23532 (patch) | |
| tree | 187c2bcee269ffc94bc1e196b1fd79d90a55ec34 /lib/models/Vote.php | |
| parent | 9e1c49e36db2a40809dc9d9f6f18fcad066130f4 (diff) | |
prevent php-warnings, refs #2277
Merge request studip/studip!1502
Diffstat (limited to 'lib/models/Vote.php')
| -rw-r--r-- | lib/models/Vote.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/models/Vote.php b/lib/models/Vote.php index 9c81b2d..d3d6d75 100644 --- a/lib/models/Vote.php +++ b/lib/models/Vote.php @@ -5,7 +5,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType { public static function getIcon(bool $active = false) : Icon { - return Icon::create(static::getIconShape(), $active ? 'clickable' : 'info'); + return Icon::create(static::getIconShape(), $active ? Icon::ROLE_CLICKABLE : Icon::ROLE_INFO); } /** @@ -32,7 +32,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType $questiondata['description'] = \Studip\Markup::markAsHtml( \Studip\Markup::purifyHtml($questiondata['description']) ); - $questiondata['options'] = array_filter($questiondata['options']); + $questiondata['options'] = array_filter($questiondata['options'] ?? []); return $questiondata; } @@ -49,6 +49,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType $answer = $this->getMyAnswer(); $answers = Request::getArray('answers'); + $userAnswer = 0; if (array_key_exists($this->getId(), $answers)) { $userAnswer = $answers[$this->getId()]['answerdata']['answers']; if (is_array($userAnswer)) { |
