ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssLacStringResultExpression Class Reference

Class StringResultExpression for the expression ~TEXT~. 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...
 
 addNode (ilAssLacCompositeInterface $node)
 Adds an CompositeInterface object to the node array which represents the condition tree structure. More...
 
 describe ()
 Describes a Composite tree Structure as human readable string. More...
 
 getDescription ()
 Get a human readable description of the Composite element. More...
 
 getValue ()
 Get the value of this Expression. More...
 
 parseValue ($value)
 Parses the delivered Value and sets the relevant information for an Expression as attributes. More...
 
 checkResult ($result, $comperator, $index=null)
 

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...
 
 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

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 14 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 95 of file ilAssLacStringResultExpression.php.

96 {
97 $isTrue = false;
98 if($index == null)
99 {
100 $values = $result->getUserSolutionsByIdentifier("value");
101
102 foreach($values as $value)
103 {
104 $isTrue = $isTrue || $this->compare($comperator, $value);
105 }
106 }
107 else
108 {
109 $solution = $result->getSolutionForKey($index);
110 $isTrue = $this->compare($comperator, $solution["value"]);
111 }
112
113 return $isTrue;
114 }
$result

References $result, and compare().

+ Here is the call graph for this function:

◆ compare()

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

Definition at line 122 of file ilAssLacStringResultExpression.php.

123 {
124 switch($comperator)
125 {
126 case "=":
127 return $this->getText() == $value;
128 break;
129 case "<>":
130 return $this->getText() != $value;
131 break;
132 default:
133 return false;
134 }
135 }

References getText().

Referenced by checkResult().

+ 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 83 of file ilAssLacStringResultExpression.php.

84 {
85 return $this->text . " beantwortet ";
86 }

◆ getPattern()

ilAssLacStringResultExpression::getPattern ( )

Get the Pattern to match relevant informations for an Expression.

Returns
string

Reimplemented from ilAssLacAbstractExpression.

Definition at line 45 of file ilAssLacStringResultExpression.php.

46 {
47 return '/~(.*)~/';
48 }

◆ getText()

ilAssLacStringResultExpression::getText ( )
Returns
string

Definition at line 65 of file ilAssLacStringResultExpression.php.

References $text.

Referenced by compare().

+ Here is the caller graph for this function:

◆ getValue()

ilAssLacStringResultExpression::getValue ( )

Get the value of this Expression.

Returns
string

Implements ilAssLacExpressionInterface.

Definition at line 74 of file ilAssLacStringResultExpression.php.

75 {
76 return "~" . $this->text . '~';
77 }

◆ 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

Reimplemented from ilAssLacAbstractExpression.

Definition at line 57 of file ilAssLacStringResultExpression.php.

58 {
59 $this->text = $matches[1][0];
60 }

Field Documentation

◆ $identifier

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

Definition at line 32 of file ilAssLacStringResultExpression.php.

◆ $pattern

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

◆ $text

ilAssLacStringResultExpression::$text
protected

Definition at line 39 of file ilAssLacStringResultExpression.php.

Referenced by getText().


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