19 declare(strict_types=1);
57 $this->
lng = $DIC->language();
96 $this->definition = clone $a_def;
117 return (clone $this->definition);
130 abstract public function equals(
ilADT $a_adt): ?bool;
215 $this->
equals($a_adt_from) ||
216 $this->
equals($a_adt_to) ||
224 abstract public function isNull(): bool;
228 $this->validation_errors = [];
239 $this->validation_errors[] = $a_error_code;
250 is_array($this->validation_errors) &&
251 count($this->validation_errors)) {
252 return array_unique($this->validation_errors);
266 case self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED:
267 return $this->
lng->txt(
"msg_input_is_required");
269 case self::ADT_VALIDATION_ERROR_MAX_LENGTH:
270 return $this->
lng->txt(
"adt_error_max_length");
272 case self::ADT_VALIDATION_ERROR_MAX_SIZE:
273 return $this->
lng->txt(
"adt_error_max_size");
275 case self::ADT_VALIDATION_ERROR_MIN:
276 return $this->
lng->txt(
"form_msg_value_too_low");
278 case self::ADT_VALIDATION_ERROR_MAX:
279 return $this->
lng->txt(
"form_msg_value_too_high");
282 case self::ADT_VALIDATION_DATE:
283 return $this->
lng->txt(
"exc_date_not_valid");
285 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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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