ILIAS
Release_5_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilADTDate.php
Go to the documentation of this file.
1
<?php
2
3
class
ilADTDate
extends
ilADT
4
{
5
protected
$value
;
// [ilDateTime]
6
7
8
// definition
9
10
protected
function
isValidDefinition
(
ilADTDefinition
$a_def)
11
{
12
return
($a_def instanceof
ilADTDateDefinition
);
13
}
14
15
public
function
reset
()
16
{
17
parent::reset
();
18
19
$this->value = null;
20
}
21
22
23
// properties
24
25
public
function
setDate
(
ilDateTime
$a_value = null)
26
{
27
if
($a_value && $a_value->isNull())
28
{
29
$a_value = null;
30
}
31
$this->value = $a_value;
32
}
33
34
public
function
getDate
()
35
{
36
return
$this->value
;
37
}
38
39
40
// comparison
41
42
public
function
equals
(
ilADT
$a_adt)
43
{
44
if
($this->
getDefinition
()->isComparableTo($a_adt))
45
{
46
if
(!$this->
isNull
() && !$a_adt->
isNull
())
47
{
48
// could use checksum...
49
$value
= $this->
getDate
()->get(
IL_CAL_UNIX
);
50
$other = $a_adt->getDate()->get(
IL_CAL_UNIX
);
51
return
(
$value
== $other);
52
}
53
}
54
// null?
55
}
56
57
public
function
isLarger
(
ilADT
$a_adt)
58
{
59
if
($this->
getDefinition
()->isComparableTo($a_adt))
60
{
61
if
(!$this->
isNull
() && !$a_adt->
isNull
())
62
{
63
$value
= $this->
getDate
()->get(
IL_CAL_UNIX
);
64
$other = $a_adt->getDate()->get(
IL_CAL_UNIX
);
65
return
(
$value
> $other);
66
}
67
}
68
}
69
70
public
function
isSmaller
(
ilADT
$a_adt)
71
{
72
if
($this->
getDefinition
()->isComparableTo($a_adt))
73
{
74
if
(!$this->
isNull
() && !$a_adt->
isNull
())
75
{
76
$value
= $this->
getDate
()->get(
IL_CAL_UNIX
);
77
$other = $a_adt->getDate()->get(
IL_CAL_UNIX
);
78
return
(
$value
< $other);
79
}
80
}
81
}
82
83
84
// null
85
86
public
function
isNull
()
87
{
88
return
(!($this->value instanceof
ilDate
) || $this->value->isNull());
89
}
90
91
92
// validation
93
94
public
function
isValid
()
95
{
96
$valid
=
parent::isValid
();
97
98
/* timestamp is "always" valid
99
if(!$this->isNull())
100
{
101
$value = getdate($this->getDate()->get(IL_CAL_UNIX));
102
if(!checkdate($value["mon"], $value["mday"], $value["year"]))
103
{
104
$valid = false;
105
$this->addValidationError(self::ADT_VALIDATION_DATE);
106
}
107
}
108
*/
109
110
return
$valid
;
111
}
112
113
114
// check
115
116
public
function
getCheckSum
()
117
{
118
if
(!$this->
isNull
())
119
{
120
return
(
string
)$this->
getDate
()->get(
IL_CAL_UNIX
);
121
}
122
}
123
}
124
125
?>
Services
ADT
classes
Types
Date
class.ilADTDate.php
Generated on Wed Apr 27 2016 21:01:27 for ILIAS by
1.8.1.2 (using
Doxyfile
)