ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssLacOrderingResultExpression.php
Go to the documentation of this file.
1<?php
2
27{
38 public static $pattern = '/\$[0-9]+(?:,[0-9]+)*\$/';
39
43 public static $identifier = '$n,m,o,p$';
44
50 protected $ordering;
51
52 protected function getPattern(): string
53 {
54 return '/(\d+)/';
55 }
56
64 protected function setMatches($matches): void
65 {
66 $this->ordering = [];
67
68 foreach ($matches[0] as $match) {
69 $this->ordering[] = $match;
70 }
71 }
72
76 public function getOrdering(): array
77 {
78 return $this->ordering;
79 }
80
85 public function getValue(): string
86 {
87 return "$" . join(",", $this->ordering) . "$";
88 }
89
94 public function getDescription(): string
95 {
96 return join(",", $this->ordering) . " beantwortet ";
97 }
98
106 public function checkResult($result, $comperator, $index = null): bool
107 {
108 $keys = $result->getUserSolutionsByIdentifier("key");
109 $keys = array_filter($keys, function ($element) {
110 return $element != null;
111 });
112
113 switch ($comperator) {
114 case "=":
115 return $keys == $this->getOrdering();
116 break;
117 case "<>":
118 return $keys != $this->getOrdering();
119 break;
120 default:
121 return false;
122 }
123 }
124}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...