ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilADT Class Reference

ADT base class. More...

+ Inheritance diagram for ilADT:
+ Collaboration diagram for ilADT:

Public Member Functions

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

Data Fields

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"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Protected Member Functions

 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

 $definition
 
 $validation_errors = []
 

Detailed Description

ADT base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 11 of file class.ilADT.php.

Constructor & Destructor Documentation

◆ __construct()

ilADT::__construct ( ilADTDefinition  $a_def)

Constructor.

Returns
self

Definition at line 42 of file class.ilADT.php.

43 {
44 $this->setDefinition($a_def);
45 $this->reset();
46 }
reset()
Init property defaults.
Definition: class.ilADT.php:61
setDefinition(ilADTDefinition $a_def)
Set definition.
Definition: class.ilADT.php:83

References reset(), and setDefinition().

+ Here is the call graph for this function:

Member Function Documentation

◆ addValidationError()

ilADT::addValidationError (   $a_error_code)
protected

Add validation error code.

Parameters
int$a_error_code

Definition at line 230 of file class.ilADT.php.

231 {
232 $this->validation_errors[] = (string) $a_error_code;
233 }

Referenced by isValid(), ilADTExternalLink\isValid(), ilADTInteger\isValid(), ilADTInternalLink\isValid(), ilADTLocation\isValid(), ilADTMultiText\isValid(), and ilADTText\isValid().

+ Here is the caller graph for this function:

◆ equals()

ilADT::equals ( ilADT  $a_adt)
abstract

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTEnum, ilADTExternalLink, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

Referenced by isInbetweenOrEqual(), isLargerOrEqual(), and isSmallerOrEqual().

+ Here is the caller graph for this function:

◆ getCheckSum()

ilADT::getCheckSum ( )
abstract

◆ getCopyOfDefinition()

ilADT::getCopyOfDefinition ( )

Get copy of definition.

Returns
ilADTDefinition $a_def

Definition at line 107 of file class.ilADT.php.

108 {
109 return (clone $this->definition);
110 }

◆ getDefinition()

◆ getType()

ilADT::getType ( )

Get type (from class/instance)

Returns
string

Reimplemented in ilADTMultiEnum.

Definition at line 53 of file class.ilADT.php.

54 {
55 return $this->getDefinition()->getType();
56 }
getDefinition()
Get definition.
Definition: class.ilADT.php:97

References getDefinition().

Referenced by ilAdvancedMDValues\_deleteByFieldId(), ilADTFactory\getActiveRecordBridgeForInstance(), ilADTFactory\getDBBridgeForInstance(), ilADTFactory\getFormBridgeForInstance(), and ilADTFactory\getPresentationBridgeForInstance().

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

◆ getValidationErrors()

ilADT::getValidationErrors ( )

Get all validation error codes.

See also
isValid()
Returns
array

Reimplemented in ilADTGroup.

Definition at line 241 of file class.ilADT.php.

242 {
243 if (is_array($this->validation_errors) &&
244 sizeof($this->validation_errors)) {
245 return array_unique($this->validation_errors);
246 }
247 return array();
248 }

◆ isInbetween()

ilADT::isInbetween ( ilADT  $a_adt_from,
ilADT  $a_adt_to 
)

Check if self is inbetween given ADTs (exclusive)

Parameters
ilADT$a_adt_from
ilADT$a_adt_to
Returns
bool

Definition at line 172 of file class.ilADT.php.

173 {
174 return ($this->isLarger($a_adt_from) &&
175 $this->isSmaller($a_adt_to));
176 }
isSmaller(ilADT $a_adt)
Check if given ADT is smaller than self.
isLarger(ilADT $a_adt)
Check if given ADT is larger than self.

References isLarger(), and isSmaller().

Referenced by isInbetweenOrEqual().

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

◆ isInbetweenOrEqual()

ilADT::isInbetweenOrEqual ( ilADT  $a_adt_from,
ilADT  $a_adt_to 
)

Check if self is inbetween given ADTs (inclusive)

Parameters
ilADT$a_adt_from
ilADT$a_adt_to
Returns
bool

Definition at line 185 of file class.ilADT.php.

186 {
187 return ($this->equals($a_adt_from) ||
188 $this->equals($a_adt_to) ||
189 $this->isInbetween($a_adt_from, $a_adt_to));
190 }
equals(ilADT $a_adt)
Check if given ADT equals self.
isInbetween(ilADT $a_adt_from, ilADT $a_adt_to)
Check if self is inbetween given ADTs (exclusive)

References equals(), and isInbetween().

Referenced by ilADTDateSearchBridgeRange\isInCondition(), and ilADTDateTimeSearchBridgeRange\isInCondition().

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

◆ isLarger()

ilADT::isLarger ( ilADT  $a_adt)
abstract

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTEnum, ilADTExternalLink, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

Referenced by isInbetween(), and isLargerOrEqual().

+ Here is the caller graph for this function:

◆ isLargerOrEqual()

ilADT::isLargerOrEqual ( ilADT  $a_adt)

Check if given ADT is larger or equal than self.

Parameters
ilADT$a_adt
Returns
bool

Definition at line 139 of file class.ilADT.php.

140 {
141 return ($this->equals($a_adt) ||
142 $this->isLarger($a_adt));
143 }

References equals(), and isLarger().

Referenced by ilADTDateSearchBridgeRange\isInCondition(), and ilADTDateTimeSearchBridgeRange\isInCondition().

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

◆ isNull()

◆ isSmaller()

ilADT::isSmaller ( ilADT  $a_adt)
abstract

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTEnum, ilADTExternalLink, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

Referenced by isInbetween(), and isSmallerOrEqual().

+ Here is the caller graph for this function:

◆ isSmallerOrEqual()

ilADT::isSmallerOrEqual ( ilADT  $a_adt)

Check if given ADT is smaller or equal than self.

Parameters
ilADT$a_adt
Returns
bool

Definition at line 159 of file class.ilADT.php.

160 {
161 return ($this->equals($a_adt) ||
162 $this->isSmaller($a_adt));
163 }

References equals(), and isSmaller().

Referenced by ilADTDateSearchBridgeRange\isInCondition(), and ilADTDateTimeSearchBridgeRange\isInCondition().

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

◆ isValid()

ilADT::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTExternalLink, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiText, and ilADTText.

Definition at line 214 of file class.ilADT.php.

215 {
216 $this->validation_errors = array();
217
218 if (!$this->getDefinition()->isNullAllowed() && $this->isNull()) {
219 $this->addValidationError(self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED);
220 return false;
221 }
222 return true;
223 }
isNull()
Is currently null.
addValidationError($a_error_code)
Add validation error code.

References addValidationError(), getDefinition(), and isNull().

+ Here is the call graph for this function:

◆ isValidDefinition()

ilADT::isValidDefinition ( ilADTDefinition  $a_def)
abstractprotected

Check if definition is valid for ADT.

Returns
bool;

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTEnum, ilADTExternalLink, ilADTFloat, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

Referenced by setDefinition().

+ Here is the caller graph for this function:

◆ reset()

ilADT::reset ( )
protected

Init property defaults.

Reimplemented in ilADTBoolean, ilADTDate, ilADTDateTime, ilADTEnum, ilADTExternalLink, ilADTGroup, ilADTInteger, ilADTInternalLink, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

Definition at line 61 of file class.ilADT.php.

62 {
63 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setDefinition()

ilADT::setDefinition ( ilADTDefinition  $a_def)
protected

Set definition.

Exceptions
ilException
Parameters
ilADTDefinition$a_def

Reimplemented in ilADTGroup.

Definition at line 83 of file class.ilADT.php.

84 {
85 if ($this->isValidDefinition($a_def)) {
86 $this->definition = clone $a_def;
87 } else {
88 throw new ilException("ilADT invalid definition");
89 }
90 }
isValidDefinition(ilADTDefinition $a_def)
Check if definition is valid for ADT.
Base class for ILIAS Exception handling.

References isValidDefinition().

Referenced by __construct().

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

◆ translateErrorCode()

ilADT::translateErrorCode (   $a_code)

Translate error-code to human-readable message.

Exceptions
Exception
Parameters
int$a_code
Returns
string

Reimplemented in ilADTGroup, and ilADTLocation.

Definition at line 257 of file class.ilADT.php.

258 {
259 global $DIC;
260
261 $lng = $DIC['lng'];
262
263 // $lng->txt("msg_wrong_format");
264
265 switch ($a_code) {
267 return $lng->txt("msg_input_is_required");
268
270 return $lng->txt("adt_error_max_length");
271
273 return $lng->txt("adt_error_max_size");
274
276 return $lng->txt("form_msg_value_too_low");
277
279 return $lng->txt("form_msg_value_too_high");
280
281 // :TODO: currently not used - see ilDateTimeInputGUI
283 return $lng->txt("exc_date_not_valid");
284
285 default:
286 throw new Exception("ADT unknown error code");
287 }
288 }
const ADT_VALIDATION_ERROR_MAX_SIZE
Definition: class.ilADT.php:25
const ADT_VALIDATION_ERROR_MAX_LENGTH
Definition: class.ilADT.php:22
const ADT_VALIDATION_ERROR_MAX
Definition: class.ilADT.php:29
const ADT_VALIDATION_ERROR_MIN
Definition: class.ilADT.php:28
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED
Definition: class.ilADT.php:19
const ADT_VALIDATION_DATE
Definition: class.ilADT.php:32
global $DIC
Definition: saml.php:7
$lng

References $DIC, $lng, ADT_VALIDATION_DATE, ADT_VALIDATION_ERROR_MAX, ADT_VALIDATION_ERROR_MAX_LENGTH, ADT_VALIDATION_ERROR_MAX_SIZE, ADT_VALIDATION_ERROR_MIN, and ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED.

Field Documentation

◆ $definition

ilADT::$definition
protected

Definition at line 13 of file class.ilADT.php.

Referenced by getDefinition().

◆ $validation_errors

ilADT::$validation_errors = []
protected

Definition at line 14 of file class.ilADT.php.

Referenced by ilADTGroup\getValidationErrorsByElements().

◆ ADT_VALIDATION_DATE

const ilADT::ADT_VALIDATION_DATE = "adt6"

Definition at line 32 of file class.ilADT.php.

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_INVALID_NODE

const ilADT::ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'

Definition at line 35 of file class.ilADT.php.

◆ ADT_VALIDATION_ERROR_MAX

const ilADT::ADT_VALIDATION_ERROR_MAX = "adt5"

Definition at line 29 of file class.ilADT.php.

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_MAX_LENGTH

const ilADT::ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"

Definition at line 22 of file class.ilADT.php.

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_MAX_SIZE

const ilADT::ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"

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

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_MIN

const ilADT::ADT_VALIDATION_ERROR_MIN = "adt4"

Definition at line 28 of file class.ilADT.php.

Referenced by translateErrorCode().

◆ ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED

const ilADT::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"

Definition at line 19 of file class.ilADT.php.

Referenced by translateErrorCode().


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