ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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"
 

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 40 of file class.ilADT.php.

References reset(), and setDefinition().

41  {
42  $this->setDefinition($a_def);
43  $this->reset();
44  }
reset()
Init property defaults.
Definition: class.ilADT.php:59
setDefinition(ilADTDefinition $a_def)
Set definition.
Definition: class.ilADT.php:82
+ 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 233 of file class.ilADT.php.

References string.

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

234  {
235  $this->validation_errors[] = (string)$a_error_code;
236  }
Add rich text string
The name of the decorator.
+ 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 ilADTMultiText\equals(), ilADTMultiEnum\equals(), ilADTGroup\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 109 of file class.ilADT.php.

References equals(), and isLarger().

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

◆ getDefinition()

◆ getType()

ilADT::getType ( )

Get type (from class/instance)

Returns
string

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

References getDefinition().

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

52  {
53  return $this->getDefinition()->getType();
54  }
getDefinition()
Get definition.
Definition: class.ilADT.php:99
+ 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 244 of file class.ilADT.php.

References array.

245  {
246  if(is_array($this->validation_errors) &&
247  sizeof($this->validation_errors))
248  {
249  return array_unique($this->validation_errors);
250  }
251  return array();
252  }
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 174 of file class.ilADT.php.

References isLarger(), and isSmaller().

Referenced by isInbetweenOrEqual().

175  {
176  return ($this->isLarger($a_adt_from) &&
177  $this->isSmaller($a_adt_to));
178  }
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 187 of file class.ilADT.php.

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

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

188  {
189  return ($this->equals($a_adt_from) ||
190  $this->equals($a_adt_to) ||
191  $this->isInbetween($a_adt_from, $a_adt_to));
192  }
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 141 of file class.ilADT.php.

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

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

142  {
143  return ($this->equals($a_adt) ||
144  $this->isLarger($a_adt));
145  }
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 161 of file class.ilADT.php.

References equals(), and isSmaller().

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

162  {
163  return ($this->equals($a_adt) ||
164  $this->isSmaller($a_adt));
165  }
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 216 of file class.ilADT.php.

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

217  {
218  $this->validation_errors = array();
219 
220  if(!$this->getDefinition()->isNullAllowed() && $this->isNull())
221  {
222  $this->addValidationError(self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED);
223  return false;
224  }
225  return true;
226  }
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:99
+ 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 59 of file class.ilADT.php.

References isValidDefinition().

Referenced by __construct().

60  {
61 
62  }
+ 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 82 of file class.ilADT.php.

References isValidDefinition().

Referenced by __construct().

83  {
84  if($this->isValidDefinition($a_def))
85  {
86  $this->definition = clone $a_def;
87  }
88  else
89  {
90  throw new ilException("ilADT invalid definition");
91  }
92  }
Base class for ILIAS Exception handling.
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 261 of file class.ilADT.php.

References $lng, and getCheckSum().

262  {
263  global $lng;
264 
265  // $lng->txt("msg_wrong_format");
266 
267  switch($a_code)
268  {
269  case self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED:
270  return $lng->txt("msg_input_is_required");
271 
272  case self::ADT_VALIDATION_ERROR_MAX_LENGTH:
273  return $lng->txt("adt_error_max_length");
274 
275  case self::ADT_VALIDATION_ERROR_MAX_SIZE:
276  return $lng->txt("adt_error_max_size");
277 
278  case self::ADT_VALIDATION_ERROR_MIN:
279  return $lng->txt("form_msg_value_too_low");
280 
281  case self::ADT_VALIDATION_ERROR_MAX:
282  return $lng->txt("form_msg_value_too_high");
283 
284  // :TODO: currently not used - see ilDateTimeInputGUI
285  case self::ADT_VALIDATION_DATE:
286  return $lng->txt("exc_date_not_valid");
287 
288  default:
289  throw new Exception("ADT unknown error code");
290  }
291  }
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_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: