ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ ilDoc Overview
class.arWhere.php
Go to the documentation of this file.
1
<?
php
2
require_once(dirname(__FILE__) .
'/../Statement/class.arStatement.php'
);
3
10
class
arWhere
extends
arStatement
11
{
12
const
TYPE_STRING
= 1;
13
const
TYPE_REGULAR
= 2;
17
protected
$type
= self::TYPE_REGULAR;
21
protected
$fieldname
=
''
;
25
protected
$value
;
29
protected
$operator =
'='
;
33
protected
$statement
=
''
;
37
protected
$link
=
'AND'
;
38
39
48
public
function
asSQLStatement
(
ActiveRecord
$ar)
49
{
50
if
($this->
getType
() == self::TYPE_REGULAR) {
51
$arField = $ar->
getArFieldList
()->getFieldByName($this->
getFieldname
());
52
if
($arField instanceof
arField
) {
53
$type
= $arField->getFieldType();
54
$statement
= $ar->
getConnectorContainerName
() .
'.'
. $this->
getFieldname
();
55
}
else
{
56
$statement
= $this->
getFieldname
();
57
}
58
59
if
(is_array($this->
getValue
())) {
60
if
(in_array($this->
getOperator
(), array(
'IN'
,
'NOT IN'
,
'NOTIN'
))) {
61
$statement
.=
' '
. $this->
getOperator
() .
' ('
;
62
}
else
{
63
$statement
.=
' IN ('
;
64
}
65
$values
= array();
66
foreach
($this->
getValue
() as
$value
) {
67
$values
[] = $ar->
getArConnector
()->quote($value,
$type
);
68
}
69
$statement
.= implode(
', '
,
$values
);
70
$statement
.=
')'
;
71
}
else
{
72
if
($this->
getValue
() === null) {
73
$operator =
'IS'
;
74
if
(in_array($this->
getOperator
(), array(
'IS'
,
'IS NOT'
))) {
75
$operator = $this->
getOperator
();
76
}
77
$this->
setOperator
($operator);
78
}
79
$statement
.=
' '
. $this->
getOperator
();
80
$statement
.=
' '
. $ar->
getArConnector
()->quote($this->
getValue
(),
$type
);
81
}
82
$this->
setStatement
(
$statement
);
83
}
84
85
return
$this->
getStatement
();
86
}
87
88
92
public
function
setFieldname
(
$fieldname
)
93
{
94
$this->fieldname =
$fieldname
;
95
}
96
97
101
public
function
getFieldname
()
102
{
103
return
$this->fieldname
;
104
}
105
106
110
public
function
setOperator
($operator)
111
{
112
$this->
operator
= $operator;
113
}
114
115
119
public
function
getOperator
()
120
{
121
return
$this->operator;
122
}
123
124
128
public
function
setValue
(
$value
)
129
{
130
$this->value =
$value
;
131
}
132
133
137
public
function
getValue
()
138
{
139
return
$this->value
;
140
}
141
142
146
public
function
setType
(
$type
)
147
{
148
$this->type =
$type
;
149
}
150
151
155
public
function
getType
()
156
{
157
return
$this->type
;
158
}
159
160
164
public
function
setStatement
(
$statement
)
165
{
166
$this->statement =
$statement
;
167
}
168
169
173
public
function
getStatement
()
174
{
175
return
$this->statement
;
176
}
177
178
182
public
function
setLink
(
$link
)
183
{
184
$this->link =
$link
;
185
}
186
187
191
public
function
getLink
()
192
{
193
return
$this->link
;
194
}
195
}
arField
Class arField.
Definition:
class.arField.php:10
arWhere\$value
$value
Definition:
class.arWhere.php:25
arWhere\getStatement
getStatement()
Definition:
class.arWhere.php:173
arWhere\setFieldname
setFieldname($fieldname)
Definition:
class.arWhere.php:92
ActiveRecord\getArConnector
getArConnector()
Definition:
class.ActiveRecord.php:40
ActiveRecord
Class ActiveRecord.
Definition:
class.ActiveRecord.php:24
arWhere
Class arWhere.
Definition:
class.arWhere.php:10
arWhere\setStatement
setStatement($statement)
Definition:
class.arWhere.php:164
arWhere\$fieldname
$fieldname
Definition:
class.arWhere.php:21
arWhere\getType
getType()
Definition:
class.arWhere.php:155
arWhere\getLink
getLink()
Definition:
class.arWhere.php:191
arWhere\asSQLStatement
asSQLStatement(ActiveRecord $ar)
Build WHERE Statement
Definition:
class.arWhere.php:48
arStatement
Class arStatement.
Definition:
class.arStatement.php:10
arWhere\TYPE_REGULAR
const TYPE_REGULAR
Definition:
class.arWhere.php:13
arWhere\$statement
$statement
Definition:
class.arWhere.php:33
$values
$values
Definition:
testOperations.php:7
arWhere\setLink
setLink($link)
Definition:
class.arWhere.php:182
ActiveRecord\getConnectorContainerName
getConnectorContainerName()
Definition:
class.ActiveRecord.php:69
arWhere\setType
setType($type)
Definition:
class.arWhere.php:146
arWhere\$type
$type
Definition:
class.arWhere.php:17
arWhere\getOperator
getOperator()
Definition:
class.arWhere.php:119
ActiveRecord\getArFieldList
getArFieldList()
Definition:
class.ActiveRecord.php:49
arWhere\getFieldname
getFieldname()
Definition:
class.arWhere.php:101
arWhere\getValue
getValue()
Definition:
class.arWhere.php:137
arWhere\$link
$link
Definition:
class.arWhere.php:37
php
arWhere\setValue
setValue($value)
Definition:
class.arWhere.php:128
arWhere\TYPE_STRING
const TYPE_STRING
Definition:
class.arWhere.php:12
arWhere\setOperator
setOperator($operator)
Definition:
class.arWhere.php:110
Services
ActiveRecord
Connector
Where
class.arWhere.php
Generated on Thu Feb 27 2025 19:01:51 for ILIAS by
1.8.13 (using
Doxyfile
)