3 declare(strict_types=1);
43 $this->
lng = $DIC->language();
82 $this->definition = clone $a_def;
103 return (clone $this->definition);
116 abstract public function equals(
ilADT $a_adt): ?bool;
130 if ($this->
equals($a_adt) === null || $this->
isLarger($a_adt) === null) {
153 if ($this->
equals($a_adt) === null || $this->
isSmaller($a_adt) === null) {
173 if ($this->
isLarger($a_adt_from) === null || $this->
isSmaller($a_adt_to) === null) {
194 $this->
equals($a_adt_from) === null ||
195 $this->
equals($a_adt_to) === null ||
196 $this->
isInbetween($a_adt_from, $a_adt_to) === null
201 $this->
equals($a_adt_from) ||
202 $this->
equals($a_adt_to) ||
210 abstract public function isNull(): bool;
214 $this->validation_errors = [];
225 $this->validation_errors[] = $a_error_code;
236 is_array($this->validation_errors) &&
237 count($this->validation_errors)) {
238 return array_unique($this->validation_errors);
252 case self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED:
253 return $this->
lng->txt(
"msg_input_is_required");
255 case self::ADT_VALIDATION_ERROR_MAX_LENGTH:
256 return $this->
lng->txt(
"adt_error_max_length");
258 case self::ADT_VALIDATION_ERROR_MAX_SIZE:
259 return $this->
lng->txt(
"adt_error_max_size");
261 case self::ADT_VALIDATION_ERROR_MIN:
262 return $this->
lng->txt(
"form_msg_value_too_low");
264 case self::ADT_VALIDATION_ERROR_MAX:
265 return $this->
lng->txt(
"form_msg_value_too_high");
268 case self::ADT_VALIDATION_DATE:
269 return $this->
lng->txt(
"exc_date_not_valid");
272 throw new Exception(
"ADT unknown error code");
getType()
Get type (from class/instance)
equals(ilADT $a_adt)
Check if given ADT equals self.
addValidationError(string $a_error_code)
const ADT_VALIDATION_ERROR_MAX_SIZE
const ADT_VALIDATION_ERROR_INVALID_NODE
isSmaller(ilADT $a_adt)
Check if given ADT is smaller than self.
const ADT_VALIDATION_ERROR_MIN
isLarger(ilADT $a_adt)
Check if given ADT is larger than self.
isLargerOrEqual(ilADT $a_adt)
const ADT_VALIDATION_ERROR_MAX_LENGTH
isInbetweenOrEqual(ilADT $a_adt_from, ilADT $a_adt_to)
Check if self is inbetween given ADTs (inclusive)
isSmallerOrEqual(ilADT $a_adt)
Check if given ADT is smaller or equal than self.
exportStdClass()
Export value as stdClass.
isValidDefinition(ilADTDefinition $a_def)
Check if definition is valid for ADT.
const ADT_VALIDATION_ERROR_MAX
reset()
Init property defaults.
__construct(ilADTDefinition $a_def)
importStdClass(?stdClass $a_std)
Import value from stdClass.
getValidationErrors()
Get all validation error codes.
isInbetween(ilADT $a_adt_from, ilADT $a_adt_to)
Check if self is inbetween given ADTs (exclusive)
isNull()
Is currently null.
translateErrorCode(string $a_code)
Translate error-code to human-readable message.
getCopyOfDefinition()
Get copy of definition.
getCheckSum()
Get unique checksum.
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED
setDefinition(ilADTDefinition $a_def)
Set definition.
ADT definition base class.
const ADT_VALIDATION_DATE
getDefinition()
Get definition.
ilADTDefinition $definition