ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilAssLacExclusiveResultExpression.php
Go to the documentation of this file.
1 <?php
2 
3 include_once "Modules/TestQuestionPool/classes/questions/LogicalAnswerCompare/Expressions/ilAssLacAbstractExpression.php";
4 include_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  $this->exclusive[] = $match;
58  }
59  }
60 
64  public function getExclusive()
65  {
66  return $this->exclusive;
67  }
68 
73  public function getValue()
74  {
75  return "*" . join(",", $this->exclusive) . "*";
76  }
77 
82  public function getDescription()
83  {
84  return join(",", $this->exclusive) . " beantwortet ";
85  }
86 
94  public function checkResult($result, $comperator, $index = null)
95  {
96  $values = $result->getUserSolutionsByIdentifier("value");
97  $exclusive = $this->getExclusive();
98  sort($values);
99  sort($exclusive);
100 
101  switch ($comperator) {
102  case "=":
103  return $values == $exclusive;
104  break;
105  case "<>":
106  return $values != $exclusive;
107  break;
108  default:
109  return false;
110  }
111  }
112 }
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
$result
getDescription()
Get a human readable description of the Composite element.
$index
Definition: metadata.php:60
Class ExclusiveResultExpression for the expression m,n,o,p
checkResult($result, $comperator, $index=null)
Create styles array
The data for the language used.
getValue()
Get the value of this Expression.