ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
ilAssLacStringResultExpression 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 ilAssLacStringResultExpression:
+ Collaboration diagram for ilAssLacStringResultExpression:

Public Member Functions

 getPattern ()
 Get the Pattern to match relevant informations for an Expression. More...
 
 getText ()
 
 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 = "/~.*?~/"
 
static $identifier = "~TEXT~"
 

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

 $text
 

Private Member Functions

 compare ($comperator, $value)
 

Additional Inherited Members

- Data Fields inherited from ilAssLacAbstractComposite
 $nodes = array()
 

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 StringResultExpression for the expression ~TEXT~

Date: 25.03.13 Time: 16:41

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

Definition at line 27 of file ilAssLacStringResultExpression.php.

Member Function Documentation

◆ checkResult()

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

Implements ilAssLacSolutionExpressionInterface.

Definition at line 108 of file ilAssLacStringResultExpression.php.

References compare().

108  : bool
109  {
110  $isTrue = false;
111  if ($index == null) {
112  $values = $result->getUserSolutionsByIdentifier("value");
113 
114  foreach ($values as $value) {
115  $isTrue = $isTrue || $this->compare($comperator, $value);
116  }
117  } else {
118  $solution = $result->getSolutionForKey($index);
119  $isTrue = $this->compare($comperator, $solution["value"]);
120  }
121 
122  return $isTrue;
123  }
+ Here is the call graph for this function:

◆ compare()

ilAssLacStringResultExpression::compare (   $comperator,
  $value 
)
private
Parameters
string$comperator
mixed$value
Returns
bool

Definition at line 131 of file ilAssLacStringResultExpression.php.

References getText().

Referenced by checkResult().

131  : bool
132  {
133  switch ($comperator) {
134  case "=":
135  return $this->getText() == $value;
136  break;
137  case "<>":
138  return $this->getText() != $value;
139  break;
140  default:
141  return false;
142  }
143  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilAssLacStringResultExpression::getDescription ( )

Get a human readable description of the Composite element.

Returns
string

Implements ilAssLacCompositeInterface.

Definition at line 96 of file ilAssLacStringResultExpression.php.

96  : string
97  {
98  return $this->text . " beantwortet ";
99  }

◆ getPattern()

ilAssLacStringResultExpression::getPattern ( )

Get the Pattern to match relevant informations for an Expression.

Returns
string

Definition at line 58 of file ilAssLacStringResultExpression.php.

58  : string
59  {
60  return '/~(.*)~/';
61  }

◆ getText()

ilAssLacStringResultExpression::getText ( )
Returns
string

Definition at line 78 of file ilAssLacStringResultExpression.php.

References $text.

Referenced by compare().

78  : string
79  {
80  return $this->text;
81  }
+ Here is the caller graph for this function:

◆ getValue()

ilAssLacStringResultExpression::getValue ( )

Get the value of this Expression.

Returns
string

Implements ilAssLacExpressionInterface.

Definition at line 87 of file ilAssLacStringResultExpression.php.

87  : string
88  {
89  return "~" . $this->text . '~';
90  }

◆ setMatches()

ilAssLacStringResultExpression::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 70 of file ilAssLacStringResultExpression.php.

70  : void
71  {
72  $this->text = $matches[1][0];
73  }

Field Documentation

◆ $identifier

ilAssLacStringResultExpression::$identifier = "~TEXT~"
static

Definition at line 45 of file ilAssLacStringResultExpression.php.

◆ $pattern

ilAssLacStringResultExpression::$pattern = "/~.*?~/"
static

◆ $text

ilAssLacStringResultExpression::$text
protected

Definition at line 52 of file ilAssLacStringResultExpression.php.

Referenced by getText().


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