ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssLacOrderingResultExpression.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{
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
Class OrderingResultExpression for the expression $a,..,n,m$.
getPattern()
Get the Pattern to match relevant informations for an Expression.
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
getDescription()
Get a human readable description of the Composite element.
getValue()
Get the value of this Expression.
checkResult($result, $comperator, $index=null)