Skip to content

Commit

Permalink
Extended condition check
Browse files Browse the repository at this point in the history
  • Loading branch information
hschottm committed Feb 28, 2019
1 parent 4ddbe91 commit a9abf57
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Resources/contao/elements/ContentSurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] == '<=') {
Expand Down

0 comments on commit a9abf57

Please sign in to comment.