/** * @param ilUserQuestionResult $result * @param string $comperator * @param null|int $index * * @return bool */ public function checkResult($result, $comperator, $index = null) { if ($index == null) { switch ($comperator) { case "=": return !$result->hasSolutions(); break; case "<>": return $result->hasSolutions(); break; default: return false; } } else { $solution = $result->getSolutionForKey($index); switch ($comperator) { case "=": return $solution == null; break; case "<>": return $solution != null; break; default: return false; } } }
/** * @param ilUserQuestionResult $result * @param string $comperator * @param null|int $index * * @return bool */ public function checkResult($result, $comperator, $index = null) { $isTrue = false; if ($index == null) { $values = $result->getUserSolutionsByIdentifier("key"); foreach ($values as $value) { $isTrue = $isTrue || $this->compare($comperator, $value); } } else { $solution = $result->getSolutionForKey($index); $isTrue = $this->compare($comperator, $solution["value"]); } return $isTrue; }