ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilADTMultiText Class Reference
+ Inheritance diagram for ilADTMultiText:
+ Collaboration diagram for ilADTMultiText:

Public Member Functions

 reset ()
 Init property defaults. More...
 
 setTextElements (array $a_values=null)
 
 getTextElements ()
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 Is currently valid. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 Constructor. More...
 
 getType ()
 Get type (from class/instance) More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 Check if given ADT is larger or equal than self. More...
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 Is currently valid. More...
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode ($a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
- Protected Member Functions inherited from ilADT
 reset ()
 Init property defaults. More...
 
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError ($a_error_code)
 Add validation error code. More...
 

Protected Attributes

 $values
 
- Protected Attributes inherited from ilADT
 $definition
 
 $validation_errors
 

Additional Inherited Members

- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 

Detailed Description

Definition at line 3 of file class.ilADTMultiText.php.

Member Function Documentation

◆ equals()

ilADTMultiText::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 57 of file class.ilADTMultiText.php.

58 {
59 if($this->getDefinition()->isComparableTo($a_adt))
60 {
61 return ($this->getCheckSum() == $a_adt->getCheckSum());
62 }
63 }
getCheckSum()
Get unique checksum.
getCheckSum()
Get unique checksum.
getDefinition()
Get definition.
Definition: class.ilADT.php:99

References ilADT\getCheckSum(), getCheckSum(), and ilADT\getDefinition().

+ Here is the call graph for this function:

◆ getCheckSum()

ilADTMultiText::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

Definition at line 120 of file class.ilADTMultiText.php.

121 {
122 if(!$this->isNull())
123 {
124 $elements = $this->getTextElements();
125 sort($elements);
126 return md5(implode("", $elements));
127 }
128 }
isNull()
Is currently null.

References getTextElements(), and isNull().

Referenced by equals().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextElements()

ilADTMultiText::getTextElements ( )

Definition at line 49 of file class.ilADTMultiText.php.

50 {
51 return $this->values;
52 }

References $values.

Referenced by getCheckSum(), isNull(), and isValid().

+ Here is the caller graph for this function:

◆ isLarger()

ilADTMultiText::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 65 of file class.ilADTMultiText.php.

66 {
67 // return null?
68 }

◆ isNull()

ilADTMultiText::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

Definition at line 78 of file class.ilADTMultiText.php.

79 {
80 $all = $this->getTextElements();
81 return (!is_array($all) || !sizeof($all));
82 }

References getTextElements().

Referenced by getCheckSum(), and isValid().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTMultiText::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 70 of file class.ilADTMultiText.php.

71 {
72 // return null?
73 }

◆ isValid()

ilADTMultiText::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

Definition at line 87 of file class.ilADTMultiText.php.

88 {
89 $valid = parent::isValid();
90
91 if(!$this->isNull())
92 {
93 $max_size = $this->getDefinition()->getMaxSize();
94 if($max_size && $max_size < sizeof($this->getTextElements()))
95 {
96 $valid = false;
97 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_SIZE);
98 }
99
100 $max_len = $this->getDefinition()->getMaxLength();
101 if($max_len)
102 {
103 foreach($this->getTextElements() as $element)
104 {
105 if($max_len < strlen($element))
106 {
107 $valid = false;
108 $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX_LENGTH);
109 }
110 }
111 }
112 }
113
114 return $valid;
115 }
addValidationError($a_error_code)
Add validation error code.
$valid

References $valid, ilADT\addValidationError(), ilADT\getDefinition(), getTextElements(), and isNull().

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTMultiText::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Returns
bool;

Reimplemented from ilADT.

Definition at line 10 of file class.ilADTMultiText.php.

11 {
12 return ($a_def instanceof ilADTMultiTextDefinition);
13 }

◆ reset()

ilADTMultiText::reset ( )

Init property defaults.

Reimplemented from ilADT.

Definition at line 15 of file class.ilADTMultiText.php.

16 {
17 parent::reset();
18
19 $this->values = null;
20 }

◆ setTextElements()

ilADTMultiText::setTextElements ( array  $a_values = null)

Definition at line 25 of file class.ilADTMultiText.php.

26 {
27 if(is_array($a_values))
28 {
29 if(sizeof($a_values))
30 {
31 foreach($a_values as $idx => $element)
32 {
33 $a_values[$idx]= trim($element);
34 if(!$a_values[$idx])
35 {
36 unset($a_values[$idx]);
37 }
38 }
39 $a_values = array_unique($a_values);
40 }
41 if(!sizeof($a_values))
42 {
43 $a_values = null;
44 }
45 }
46 $this->values = $a_values;
47 }

Field Documentation

◆ $values

ilADTMultiText::$values
protected

Definition at line 5 of file class.ilADTMultiText.php.

Referenced by getTextElements().


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