ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssLacOrderingResultExpression.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 {
25  public static $pattern = '/\$[0-9]+(?:,[0-9]+)*\$/';
26 
30  public static $identifier = '$n,m,o,p$';
31 
37  protected $ordering;
38 
39  protected function getPattern()
40  {
41  return '/(\d+)/';
42  }
43 
51  protected function setMatches($matches)
52  {
53  $this->ordering = array();
54 
55  foreach($matches[0] as $match)
56  {
57  $this->ordering[] = $match;
58  }
59  }
60 
64  public function getOrdering()
65  {
66  return $this->ordering;
67  }
68 
73  public function getValue()
74  {
75  return "$" . join(",", $this->ordering) . "$";
76  }
77 
82  public function getDescription()
83  {
84  return join(",", $this->ordering) . " beantwortet ";
85  }
86 
94  public function checkResult($result, $comperator, $index = null)
95  {
96  $keys = $result->getUserSolutionsByIdentifier("key");
97  $keys = array_filter($keys,function($element) {
98  return $element != null;
99  });
100 
101  switch($comperator)
102  {
103  case "=":
104  return $keys == $this->getOrdering();
105  break;
106  case "<>":
107  return $keys != $this->getOrdering();
108  break;
109  default:
110  return false;
111  }
112  }
113 }
$result
getValue()
Get the value of this Expression.
getDescription()
Get a human readable description of the Composite element.
checkResult($result, $comperator, $index=null)
Create styles array
The data for the language used.
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
Class OrderingResultExpression for the expression $a,..,n,m$.