ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

References reset(), and setDefinition().

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

References string.

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

231  {
232  $this->validation_errors[] = (string) $a_error_code;
233  }
Add rich text string
+ 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

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

+ Here is the caller graph for this function:

◆ getCheckSum()

ilADT::getCheckSum ( )
abstract

Get unique checksum.

Returns
string

Referenced by ilADTInternalLink\equals(), ilADTMultiText\equals(), ilADTMultiEnum\equals(), ilADTGroup\equals(), ilADTExternalLink\equals(), and translateErrorCode().

+ Here is the caller graph for this function:

◆ getCopyOfDefinition()

ilADT::getCopyOfDefinition ( )

Get copy of definition.

Returns
ilADTDefinition $a_def

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

References equals(), and isLarger().

108  {
109  return (clone $this->definition);
110  }
+ Here is the call graph for this function:

◆ getDefinition()

◆ getType()

ilADT::getType ( )

Get type (from class/instance)

Returns
string

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

References getDefinition().

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

54  {
55  return $this->getDefinition()->getType();
56  }
getDefinition()
Get definition.
Definition: class.ilADT.php:97
+ 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

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

References array.

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  }
Create styles array
The data for the language used.

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

References isLarger(), and isSmaller().

Referenced by isInbetweenOrEqual().

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

References equals(), isInbetween(), and isNull().

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

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)
+ 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

Referenced by getCopyOfDefinition(), 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.

References equals(), isLarger(), and isSmaller().

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

140  {
141  return ($this->equals($a_adt) ||
142  $this->isLarger($a_adt));
143  }
equals(ilADT $a_adt)
Check if given ADT equals self.
isLarger(ilADT $a_adt)
Check if given ADT is larger than self.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNull()

ilADT::isNull ( )
abstract

Is currently null.

Returns
bool

Referenced by ilADTDate\equals(), ilADTDateTime\equals(), isInbetweenOrEqual(), ilADTDate\isLarger(), ilADTDateTime\isLarger(), ilADTDateTime\isSmaller(), ilADTDate\isSmaller(), and isValid().

+ Here is the caller graph for this function:

◆ isSmaller()

ilADT::isSmaller ( ilADT  $a_adt)
abstract

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Referenced by isInbetween(), isLargerOrEqual(), 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.

References equals(), and isSmaller().

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

160  {
161  return ($this->equals($a_adt) ||
162  $this->isSmaller($a_adt));
163  }
equals(ilADT $a_adt)
Check if given ADT equals self.
isSmaller(ilADT $a_adt)
Check if given ADT is smaller than self.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValid()

ilADT::isValid ( )

Is currently valid.

Returns
boolean

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

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

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  }
addValidationError($a_error_code)
Add validation error code.
isNull()
Is currently null.
Create styles array
The data for the language used.
getDefinition()
Get definition.
Definition: class.ilADT.php:97
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADT::isValidDefinition ( ilADTDefinition  $a_def)
abstractprotected

Check if definition is valid for ADT.

Returns
bool;

Referenced by reset(), and setDefinition().

+ Here is the caller graph for this function:

◆ reset()

ilADT::reset ( )
protected

Init property defaults.

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

References isValidDefinition().

Referenced by __construct().

62  {
63  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefinition()

ilADT::setDefinition ( ilADTDefinition  $a_def)
protected

Set definition.

Exceptions
ilException
Parameters
ilADTDefinition$a_def

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

References isValidDefinition().

Referenced by __construct().

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

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

References $DIC, $lng, and getCheckSum().

258  {
259  global $DIC;
260 
261  $lng = $DIC['lng'];
262 
263  // $lng->txt("msg_wrong_format");
264 
265  switch ($a_code) {
266  case self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED:
267  return $lng->txt("msg_input_is_required");
268 
269  case self::ADT_VALIDATION_ERROR_MAX_LENGTH:
270  return $lng->txt("adt_error_max_length");
271 
272  case self::ADT_VALIDATION_ERROR_MAX_SIZE:
273  return $lng->txt("adt_error_max_size");
274 
275  case self::ADT_VALIDATION_ERROR_MIN:
276  return $lng->txt("form_msg_value_too_low");
277 
278  case self::ADT_VALIDATION_ERROR_MAX:
279  return $lng->txt("form_msg_value_too_high");
280 
281  // :TODO: currently not used - see ilDateTimeInputGUI
282  case self::ADT_VALIDATION_DATE:
283  return $lng->txt("exc_date_not_valid");
284 
285  default:
286  throw new Exception("ADT unknown error code");
287  }
288  }
global $DIC
Definition: saml.php:7
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

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.

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

◆ ADT_VALIDATION_ERROR_MAX_LENGTH

const ilADT::ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"

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

◆ ADT_VALIDATION_ERROR_MAX_SIZE

const ilADT::ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"

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

◆ ADT_VALIDATION_ERROR_MIN

const ilADT::ADT_VALIDATION_ERROR_MIN = "adt4"

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

◆ ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED

const ilADT::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"

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


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