ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADT Class Reference

ADT base class. More...

+ Inheritance diagram for ilADT:
+ Collaboration diagram for ilADT:

Public Member Functions

 __construct (ilADTDefinition $a_def)
 Constructor.
 getType ()
 Get type (from class/instance)
 getCopyOfDefinition ()
 Get copy of definition.
 equals (ilADT $a_adt)
 Check if given ADT equals self.
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self.
 isLargerOrEqual (ilADT $a_adt)
 Check if given ADT is larger or equal than self.
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self.
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self.
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive)
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive)
 isNull ()
 Is currently null.
 isValid ()
 Is currently valid.
 getValidationErrors ()
 Get all validation error codes.
 translateErrorCode ($a_code)
 Translate error-code to human-readable message.
 getCheckSum ()
 Get unique checksum.

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.
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT.
 setDefinition (ilADTDefinition $a_def)
 Set definition.
 getDefinition ()
 Get definition.
 addValidationError ($a_error_code)
 Add validation error code.

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

ilADT::__construct ( ilADTDefinition  $a_def)

Constructor.

Returns
self

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

References reset(), and setDefinition().

{
$this->setDefinition($a_def);
$this->reset();
}

+ Here is the call graph for this function:

Member Function Documentation

ilADT::addValidationError (   $a_error_code)
protected

Add validation error code.

Parameters
int$a_error_code

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

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

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

+ Here is the caller graph for this function:

ilADT::equals ( ilADT  $a_adt)
abstract

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

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

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

+ Here is the caller graph for this function:

ilADT::getCheckSum ( )
abstract

Get unique checksum.

Returns
string

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

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

+ Here is the caller graph for this function:

ilADT::getCopyOfDefinition ( )

Get copy of definition.

Returns
ilADTDefinition $a_def

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

{
return (clone $this->definition);
}
ilADT::getType ( )

Get type (from class/instance)

Returns
string

Reimplemented in ilADTMultiEnum.

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

References getDefinition().

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

{
return $this->getDefinition()->getType();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADT::getValidationErrors ( )

Get all validation error codes.

See Also
isValid()
Returns
array

Reimplemented in ilADTGroup.

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

{
if(is_array($this->validation_errors) &&
sizeof($this->validation_errors))
{
return array_unique($this->validation_errors);
}
return array();
}
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().

{
return ($this->isLarger($a_adt_from) &&
$this->isSmaller($a_adt_to));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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(), and isInbetween().

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

{
return ($this->equals($a_adt_from) ||
$this->equals($a_adt_to) ||
$this->isInbetween($a_adt_from, $a_adt_to));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADT::isLarger ( ilADT  $a_adt)
abstract

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

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

Referenced by isInbetween(), and isLargerOrEqual().

+ Here is the caller graph for this function:

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(), and isLarger().

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

{
return ($this->equals($a_adt) ||
$this->isLarger($a_adt));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADT::isNull ( )
abstract
ilADT::isSmaller ( ilADT  $a_adt)
abstract

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

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

Referenced by isInbetween(), and isSmallerOrEqual().

+ Here is the caller graph for this function:

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

{
return ($this->equals($a_adt) ||
$this->isSmaller($a_adt));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADT::isValid ( )

Is currently valid.

Returns
boolean

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

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

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

{
$this->validation_errors = array();
if(!$this->getDefinition()->isNullAllowed() && $this->isNull())
{
$this->addValidationError(self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED);
return false;
}
return true;
}

+ Here is the call graph for this function:

ilADT::isValidDefinition ( ilADTDefinition  $a_def)
abstractprotected

Check if definition is valid for ADT.

Returns
bool;

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

Referenced by setDefinition().

+ Here is the caller graph for this function:

ilADT::reset ( )
protected

Init property defaults.

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

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

Referenced by __construct().

{
}

+ Here is the caller graph for this function:

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.

References isValidDefinition().

Referenced by __construct().

{
if($this->isValidDefinition($a_def))
{
$this->definition = clone $a_def;
}
else
{
throw new ilException("ilADT invalid definition");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

References $lng.

{
global $lng;
// $lng->txt("msg_wrong_format");
switch($a_code)
{
case self::ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED:
return $lng->txt("msg_input_is_required");
case self::ADT_VALIDATION_ERROR_MAX_LENGTH:
return $lng->txt("adt_error_max_length");
case self::ADT_VALIDATION_ERROR_MAX_SIZE:
return $lng->txt("adt_error_max_size");
case self::ADT_VALIDATION_ERROR_MIN:
return $lng->txt("form_msg_value_too_low");
case self::ADT_VALIDATION_ERROR_MAX:
return $lng->txt("form_msg_value_too_high");
// :TODO: currently not used - see ilDateTimeInputGUI
case self::ADT_VALIDATION_DATE:
return $lng->txt("exc_date_not_valid");
default:
throw new Exception("ADT unknown error code");
}
}

Field Documentation

ilADT::$definition
protected

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

Referenced by getDefinition().

ilADT::$validation_errors
protected

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

Referenced by ilADTGroup\getValidationErrorsByElements().

const ilADT::ADT_VALIDATION_DATE = "adt6"

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

const ilADT::ADT_VALIDATION_ERROR_MAX = "adt5"

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

const ilADT::ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"

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

const ilADT::ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"

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

const ilADT::ADT_VALIDATION_ERROR_MIN = "adt4"

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

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: