ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTDateTime Class Reference
+ Inheritance diagram for ilADTDateTime:
+ Collaboration diagram for ilADTDateTime:

Public Member Functions

 reset ()
 Init property defaults.
 setDate (ilDateTime $a_value=null)
 getDate ()
 equals (ilADT $a_adt)
 Check if given ADT equals self.
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self.
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self.
 isNull ()
 Is currently null.
 isValid ()
 Is currently valid.
 getCheckSum ()
 Get unique checksum.
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 Constructor.
 getType ()
 Get type (from class/instance)
 getCopyOfDefinition ()
 Get copy of definition.
 isLargerOrEqual (ilADT $a_adt)
 Check if given ADT is larger or equal 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)
 getValidationErrors ()
 Get all validation error codes.
 translateErrorCode ($a_code)
 Translate error-code to human-readable message.

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT.
- Protected Member Functions inherited from ilADT
 setDefinition (ilADTDefinition $a_def)
 Set definition.
 getDefinition ()
 Get definition.
 addValidationError ($a_error_code)
 Add validation error code.

Protected Attributes

 $value
- Protected Attributes inherited from ilADT
 $definition
 $validation_errors

Additional Inherited Members

- Data Fields inherited from ilADT
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"

Detailed Description

Definition at line 3 of file class.ilADTDateTime.php.

Member Function Documentation

ilADTDateTime::equals ( ilADT  $a_adt)

Check if given ADT equals self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 42 of file class.ilADTDateTime.php.

References $value, getDate(), ilADT\getDefinition(), IL_CAL_UNIX, isNull(), and ilADT\isNull().

{
if($this->getDefinition()->isComparableTo($a_adt))
{
if(!$this->isNull() && !$a_adt->isNull())
{
// could use checksum...
$value = $this->getDate()->get(IL_CAL_UNIX);
$other = $a_adt->getDate()->get(IL_CAL_UNIX);
return ($value == $other);
}
}
// null?
}

+ Here is the call graph for this function:

ilADTDateTime::getCheckSum ( )

Get unique checksum.

Returns
string

Reimplemented from ilADT.

Definition at line 116 of file class.ilADTDateTime.php.

References getDate(), IL_CAL_UNIX, and isNull().

{
if(!$this->isNull())
{
return (string)$this->getDate()->get(IL_CAL_UNIX);
}
}

+ Here is the call graph for this function:

ilADTDateTime::getDate ( )

Definition at line 34 of file class.ilADTDateTime.php.

References $value.

Referenced by equals(), getCheckSum(), isLarger(), and isSmaller().

{
return $this->value;
}

+ Here is the caller graph for this function:

ilADTDateTime::isLarger ( ilADT  $a_adt)

Check if given ADT is larger than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 57 of file class.ilADTDateTime.php.

References $value, getDate(), ilADT\getDefinition(), IL_CAL_UNIX, isNull(), and ilADT\isNull().

{
if($this->getDefinition()->isComparableTo($a_adt))
{
if(!$this->isNull() && !$a_adt->isNull())
{
$value = $this->getDate()->get(IL_CAL_UNIX);
$other = $a_adt->getDate()->get(IL_CAL_UNIX);
return ($value > $other);
}
}
}

+ Here is the call graph for this function:

ilADTDateTime::isNull ( )

Is currently null.

Returns
bool

Reimplemented from ilADT.

Definition at line 86 of file class.ilADTDateTime.php.

Referenced by equals(), getCheckSum(), isLarger(), and isSmaller().

{
return (!($this->value instanceof ilDateTime) || $this->value->isNull());
}

+ Here is the caller graph for this function:

ilADTDateTime::isSmaller ( ilADT  $a_adt)

Check if given ADT is smaller than self.

Parameters
ilADT$a_adt
Returns
bool

Reimplemented from ilADT.

Definition at line 70 of file class.ilADTDateTime.php.

References $value, getDate(), ilADT\getDefinition(), IL_CAL_UNIX, isNull(), and ilADT\isNull().

{
if($this->getDefinition()->isComparableTo($a_adt))
{
if(!$this->isNull() && !$a_adt->isNull())
{
$value = $this->getDate()->get(IL_CAL_UNIX);
$other = $a_adt->getDate()->get(IL_CAL_UNIX);
return ($value < $other);
}
}
}

+ Here is the call graph for this function:

ilADTDateTime::isValid ( )

Is currently valid.

Returns
boolean

Reimplemented from ilADT.

Definition at line 94 of file class.ilADTDateTime.php.

References $valid.

{
/* timestamp is "always" valid
if(!$this->isNull())
{
$value = getdate($this->getDate()->get(IL_CAL_UNIX));
if(!checkdate($value["mon"], $value["mday"], $value["year"]))
{
$valid = false;
$this->addValidationError(self::ADT_VALIDATION_DATE);
}
}
*/
return $valid;
}
ilADTDateTime::isValidDefinition ( ilADTDefinition  $a_def)
protected

Check if definition is valid for ADT.

Returns
bool;

Reimplemented from ilADT.

Definition at line 10 of file class.ilADTDateTime.php.

{
return ($a_def instanceof ilADTDateTimeDefinition);
}
ilADTDateTime::reset ( )

Init property defaults.

Reimplemented from ilADT.

Definition at line 15 of file class.ilADTDateTime.php.

{
$this->value = null;
}
ilADTDateTime::setDate ( ilDateTime  $a_value = null)

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

{
if($a_value && $a_value->isNull())
{
$a_value = null;
}
$this->value = $a_value;
}

Field Documentation

ilADTDateTime::$value
protected

Definition at line 5 of file class.ilADTDateTime.php.

Referenced by equals(), getDate(), isLarger(), and isSmaller().


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