From a9abf57d6c300819dc4ade51f4b4787dcf4b7f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20Schottm=C3=BCller?= Date: Thu, 28 Feb 2019 12:47:11 +0100 Subject: [PATCH] Extended condition check --- .../contao/elements/ContentSurvey.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Resources/contao/elements/ContentSurvey.php b/src/Resources/contao/elements/ContentSurvey.php index 73cfe53..c6bf793 100644 --- a/src/Resources/contao/elements/ContentSurvey.php +++ b/src/Resources/contao/elements/ContentSurvey.php @@ -282,9 +282,23 @@ protected function evaluateConditions($page) // check if condition is valid if ($condition['relation'] == '=') { - $applies = $applies && ($res['value'] == $condition['condition']); + if ($questionModel->questiontype == 'multiplechoice') + { + if (is_array($res['value'])) + { + $applies = $applies && in_array($condition['condition'], $res['value']); + } + else + { + $applies = $applies && ($res['value'] == $condition['condition']); + } + } + else + { + $applies = $applies && ($res['value'] == $condition['condition']); + } } else if ($condition['relation'] == '>') { - $applies = $applies && ($res['value'] < $condition['condition']); + $applies = $applies && ($res['value'] > $condition['condition']); } else if ($condition['relation'] == '<') { $applies = $applies && ($res['value'] < $condition['condition']); } else if ($condition['relation'] == '<=') {