Skip to content
Snippets Groups Projects
Commit 28ea07fb authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

prevent php-warnings, refs #2277

Merge request studip/studip!1502
parent 9e1c49e3
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType ...@@ -5,7 +5,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType
{ {
public static function getIcon(bool $active = false) : Icon 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 ...@@ -32,7 +32,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType
$questiondata['description'] = \Studip\Markup::markAsHtml( $questiondata['description'] = \Studip\Markup::markAsHtml(
\Studip\Markup::purifyHtml($questiondata['description']) \Studip\Markup::purifyHtml($questiondata['description'])
); );
$questiondata['options'] = array_filter($questiondata['options']); $questiondata['options'] = array_filter($questiondata['options'] ?? []);
return $questiondata; return $questiondata;
} }
...@@ -49,6 +49,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType ...@@ -49,6 +49,7 @@ class Vote extends QuestionnaireQuestion implements QuestionType
$answer = $this->getMyAnswer(); $answer = $this->getMyAnswer();
$answers = Request::getArray('answers'); $answers = Request::getArray('answers');
$userAnswer = 0;
if (array_key_exists($this->getId(), $answers)) { if (array_key_exists($this->getId(), $answers)) {
$userAnswer = $answers[$this->getId()]['answerdata']['answers']; $userAnswer = $answers[$this->getId()]['answerdata']['answers'];
if (is_array($userAnswer)) { if (is_array($userAnswer)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment