ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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  {
70  return $this->numeric_value;
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 }
checkResult($result, $comperator, $index=null)
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
setMatches($matches)
Sets the result of the parsed value by a specific expression pattern.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDescription()
Get a human readable description of the Composite element.
getValue()
Get the value of this Expression.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...