ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssLacPercentageResultExpression Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAssLacPercentageResultExpression:
+ Collaboration diagram for ilAssLacPercentageResultExpression:

Public Member Functions

 getNumericValue ()
 
 getValue ()
 Get the value of this Expression. More...
 
 getDescription ()
 Get a human readable description of the Composite element. More...
 
 checkResult ($result, $comperator, $index=null)
 
- Public Member Functions inherited from ilAssLacAbstractExpression
 parseValue ($value)
 Parses the delivered Value and sets the relevant information for an Expression as attributes. More...
 
- Public Member Functions inherited from ilAssLacAbstractComposite
 addNode (ilAssLacCompositeInterface $node)
 Adds an ilAssLacCompositeInterface object to the node array which represents the condition tree structure. More...
 
 describe ()
 Describes a Composite tree Structure as human readable string. More...
 

Static Public Attributes

static $pattern = '/%[0-9\.]+%/'
 
static $identifier = "%n%"
 

Protected Member Functions

 setMatches ($matches)
 Sets the result of the parsed value by a specific expression pattern. More...
 
- Protected Member Functions inherited from ilAssLacAbstractExpression
 getPattern ()
 Get the Pattern to match relevant informations for an Expression. More...
 
 setMatches ($matches)
 Sets the result of the parsed value by a specific expression pattern. More...
 

Protected Attributes

 $numeric_value
 

Additional Inherited Members

- Data Fields inherited from ilAssLacAbstractComposite
 $nodes = []
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class PercentageResultExpression for the expression n%

Date: 25.03.13 Time: 16:40

Author
Thomas Joußen tjous.nosp@m.sen@.nosp@m.datab.nosp@m.ay.d.nosp@m.e

Definition at line 26 of file ilAssLacPercentageResultExpression.php.

Member Function Documentation

◆ checkResult()

ilAssLacPercentageResultExpression::checkResult (   $result,
  $comperator,
  $index = null 
)
Parameters
ilUserQuestionResult$result
string$comperator
null$index
Returns
bool

Implements ilAssLacSolutionExpressionInterface.

Definition at line 98 of file ilAssLacPercentageResultExpression.php.

References getNumericValue().

98  : 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  }
+ Here is the call graph for this function:

◆ getDescription()

ilAssLacPercentageResultExpression::getDescription ( )

Get a human readable description of the Composite element.

Returns
string

Implements ilAssLacCompositeInterface.

Definition at line 86 of file ilAssLacPercentageResultExpression.php.

86  : string
87  {
88  return $this->numeric_value . "% beantwortet ";
89  }

◆ getNumericValue()

ilAssLacPercentageResultExpression::getNumericValue ( )
Returns
float

Definition at line 68 of file ilAssLacPercentageResultExpression.php.

References $numeric_value.

Referenced by checkResult().

+ Here is the caller graph for this function:

◆ getValue()

ilAssLacPercentageResultExpression::getValue ( )

Get the value of this Expression.

Returns
string

Implements ilAssLacExpressionInterface.

Definition at line 77 of file ilAssLacPercentageResultExpression.php.

77  : string
78  {
79  return "%" . $this->numeric_value . "%";
80  }

◆ setMatches()

ilAssLacPercentageResultExpression::setMatches (   $matches)
protected

Sets the result of the parsed value by a specific expression pattern.

See also
ExpressionInterface::parseValue()
ExpressionInterface::getPattern()
Parameters
array$matches

Definition at line 60 of file ilAssLacPercentageResultExpression.php.

60  : void
61  {
62  $this->numeric_value = $matches[0][0];
63  }

Field Documentation

◆ $identifier

ilAssLacPercentageResultExpression::$identifier = "%n%"
static

Definition at line 44 of file ilAssLacPercentageResultExpression.php.

◆ $numeric_value

ilAssLacPercentageResultExpression::$numeric_value
protected

Definition at line 51 of file ilAssLacPercentageResultExpression.php.

Referenced by getNumericValue().

◆ $pattern

ilAssLacPercentageResultExpression::$pattern = '/%[0-9\.]+%/'
static

The documentation for this class was generated from the following file: