ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssLacExclusiveResultExpression.php
Go to the documentation of this file.
1 <?php
2 
27 {
39  public static $pattern = '/\*[0-9]+(?:,[0-9]+)*\*/';
40 
44  public static $identifier = "*n,m,o,p*";
45 
51  protected $exclusive;
52 
53  protected function getPattern(): string
54  {
55  return '/(\d+)/';
56  }
57 
65  protected function setMatches($matches): void
66  {
67  $this->exclusive = [];
68 
69  foreach ($matches[0] as $match) {
70  $this->exclusive[] = $match;
71  }
72  }
73 
77  public function getExclusive(): array
78  {
79  return $this->exclusive;
80  }
81 
86  public function getValue(): string
87  {
88  return "*" . join(",", $this->exclusive) . "*";
89  }
90 
95  public function getDescription(): string
96  {
97  return join(",", $this->exclusive) . " beantwortet ";
98  }
99 
107  public function checkResult($result, $comperator, $index = null): bool
108  {
109  $values = $result->getUserSolutionsByIdentifier("value");
110  $exclusive = $this->getExclusive();
111  sort($values);
112  sort($exclusive);
113 
114  switch ($comperator) {
115  case "=":
116  return $values == $exclusive;
117  break;
118  case "<>":
119  return $values != $exclusive;
120  break;
121  default:
122  return false;
123  }
124  }
125 }
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
getDescription()
Get a human readable description of the Composite element.
sort()
description: > Example for rendering a Sort Glyph.
Definition: sort.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkResult($result, $comperator, $index=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getValue()
Get the value of this Expression.