ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssLacExclusiveResultExpression.php
Go to the documentation of this file.
1<?php
2
3include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacAbstractExpression.php";
4include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacSolutionExpressionInterface.php";
5
14{
26 public static $pattern = '/\*[0-9]+(?:,[0-9]+)*\*/';
27
31 public static $identifier = "*n,m,o,p*";
32
38 protected $exclusive;
39
40 protected function getPattern()
41 {
42 return '/(\d+)/';
43 }
44
52 protected function setMatches($matches)
53 {
54 $this->exclusive = array();
55
56 foreach($matches[0] as $match)
57 {
58 $this->exclusive[] = $match;
59 }
60 }
61
65 public function getExclusive()
66 {
67 return $this->exclusive;
68 }
69
74 public function getValue()
75 {
76 return "*" . join(",", $this->exclusive) . "*";
77 }
78
83 public function getDescription()
84 {
85 return join(",", $this->exclusive) . " beantwortet ";
86 }
87
95 public function checkResult($result, $comperator, $index = null)
96 {
97 $values = $result->getUserSolutionsByIdentifier("value");
98 $exclusive = $this->getExclusive();
99 sort($values);
100 sort($exclusive);
101
102 switch($comperator)
103 {
104 case "=":
105 return $values == $exclusive;
106 break;
107 case "<>":
108 return $values != $exclusive;
109 break;
110 default:
111 return false;
112 }
113 }
114}
$result
Class ExclusiveResultExpression for the expression m,n,o,p
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
getValue()
Get the value of this Expression.
getPattern()
Get the Pattern to match relevant informations for an Expression.
checkResult($result, $comperator, $index=null)
getDescription()
Get a human readable description of the Composite element.