ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
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 }
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.
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.