ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAssLacPercentageResultExpression.php
Go to the documentation of this file.
1<?php
2
27{
39 public static $pattern = '/%[0-9\.]+%/';
40
44 public static $identifier = "%n%";
45
51 protected $numeric_value;
52
60 protected function setMatches($matches): void
61 {
62 $this->numeric_value = $matches[0][0];
63 }
64
68 public function getNumericValue(): float
69 {
71 }
72
77 public function getValue(): string
78 {
79 return "%" . $this->numeric_value . "%";
80 }
81
86 public function getDescription(): string
87 {
88 return $this->numeric_value . "% beantwortet ";
89 }
90
98 public function checkResult($result, $comperator, $index = null): bool
99 {
100 $percentage = $result->getReachedPercentage();
101 switch ($comperator) {
102 case "<":
103 return $percentage < $this->getNumericValue();
104 break;
105 case "<=":
106 return $percentage <= $this->getNumericValue();
107 break;
108 case "=":
109 return $percentage == $this->getNumericValue();
110 break;
111 case ">=":
112 return $percentage >= $this->getNumericValue();
113 break;
114 case ">":
115 return $percentage > $this->getNumericValue();
116 break;
117 case "<>":
118 return $percentage != $this->getNumericValue();
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...
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
getDescription()
Get a human readable description of the Composite element.
checkResult($result, $comperator, $index=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...