ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

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

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

234 {
235 $this->validation_errors[] = (string)$a_error_code;
236 }

Referenced by isValid(), ilADTInteger\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, ilADTGroup, ilADTInteger, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

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

+ Here is the caller graph for this function:

◆ getCheckSum()

ilADT::getCheckSum ( )
abstract

Get unique checksum.

Returns
string

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

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

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

110 {
111 return (clone $this->definition);
112 }

◆ getDefinition()

◆ getType()

ilADT::getType ( )

Get type (from class/instance)

Returns
string

Reimplemented in ilADTMultiEnum.

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

52 {
53 return $this->getDefinition()->getType();
54 }
getDefinition()
Get definition.
Definition: class.ilADT.php:99

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

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 }

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

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.

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

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)

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, ilADTGroup, ilADTInteger, 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 141 of file class.ilADT.php.

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

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

ilADT::isNull ( )
abstract

◆ 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, ilADTGroup, ilADTInteger, 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 161 of file class.ilADT.php.

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

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, ilADTGroup, ilADTInteger, ilADTLocation, ilADTMultiText, and ilADTText.

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

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 }
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, ilADTFloat, ilADTGroup, ilADTInteger, 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, ilADTGroup, ilADTInteger, ilADTLocation, ilADTMultiEnum, ilADTMultiText, and ilADTText.

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

60 {
61
62 }

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

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

262 {
263 global $lng;
264
265 // $lng->txt("msg_wrong_format");
266
267 switch($a_code)
268 {
270 return $lng->txt("msg_input_is_required");
271
273 return $lng->txt("adt_error_max_length");
274
276 return $lng->txt("adt_error_max_size");
277
279 return $lng->txt("form_msg_value_too_low");
280
282 return $lng->txt("form_msg_value_too_high");
283
284 // :TODO: currently not used - see ilDateTimeInputGUI
286 return $lng->txt("exc_date_not_valid");
287
288 default:
289 throw new Exception("ADT unknown error code");
290 }
291 }
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 $lng
Definition: privfeed.php:40

References $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_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: