1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
result.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Connector;
9
10
use Bitrix\Main\DB\ArrayResult;
11
use Bitrix\Main\DB\Result as DbResult;
12
use Bitrix\Sender\Recipient;
13
14
class
Result
15
{
17
public
$resource
;
18
20
public
$resourceCDBResult
;
21
23
protected
$fields
;
24
26
protected
$additionalFields
;
27
29
protected
$fieldsDisallowed
= [
'NAME'
,
'USER_ID'
];
30
32
protected
$dataTypeId
=
Recipient\Type::EMAIL
;
33
37
public
function
__construct
(
$resource
)
38
{
39
if
(is_array(
$resource
))
40
{
41
$isSingleArray =
false
;
42
$arrayKeyList = array_keys(
$resource
);
43
foreach
($arrayKeyList as
$key
)
44
{
45
if
(is_string(
$key
))
46
{
47
$isSingleArray =
true
;
48
break
;
49
}
50
}
51
52
if
($isSingleArray)
53
{
54
$resource
=
array
(
$resource
);
55
}
56
57
$this->resource =
new
ArrayResult
(
$resource
);
58
}
59
elseif
(
$resource
instanceof DbResult)
60
{
61
$this->resource =
$resource
;
62
}
63
elseif
(
$resource
instanceof \
CAllDBResult
)
64
{
65
$this->resourceCDBResult =
$resource
;
66
}
67
68
$this->fieldsDisallowed = array_merge(
69
$this->fieldsDisallowed,
70
Recipient
\Type::getCodes()
71
);
72
}
73
79
public
function
getDataTypeId
()
80
{
81
return
$this->dataTypeId;
82
}
83
90
public
function
setDataTypeId
(
$dataTypeId
)
91
{
92
$this->dataTypeId =
$dataTypeId
;
93
}
94
98
public
function
setFilterFields
(
array
$fields
)
99
{
100
$this->fields =
$fields
;
101
}
102
106
public
function
getFilterFields
()
107
{
108
return
$this->fields
;
109
}
110
114
public
function
setAdditionalFields
(
array
$additionalFields
)
115
{
116
$this->additionalFields =
$additionalFields
;
117
}
118
122
public
function
fetchPlain
()
123
{
124
$result
=
null
;
125
if
($this->resource)
126
{
127
$result
= $this->resource->fetch();
128
}
129
elseif
($this->resourceCDBResult)
130
{
131
$result
= $this->resourceCDBResult->Fetch();
132
}
133
134
return
(is_array(
$result
) &&
count
(
$result
) > 0) ?
$result
:
null
;
135
}
136
140
public
function
fetch
()
141
{
142
$result
= $this->
fetchPlain
();
143
if
(
$result
)
144
{
145
$result
= $this->
fetchModifierFields
(
$result
);
146
}
147
148
return
(
$result
&&
count
(
$result
) > 0) ?
$result
:
null
;
149
}
150
151
protected
function
fetchModifierFields
(
array
$result
)
152
{
153
$fieldsList =
array
();
154
foreach
(
$result
as
$key
=> $value)
155
{
156
if
(is_object($value))
157
{
158
$value = (string) $value;
159
$result
[
$key
] = $value;
160
}
161
162
if
(in_array(
$key
, $this->fieldsDisallowed))
163
{
164
continue
;
165
}
166
167
if
($this->fields && in_array(
$key
, $this->fields))
168
{
169
$fieldsList[
$key
] = $value;
170
}
171
172
unset(
$result
[
$key
]);
173
}
174
175
if
($this->additionalFields)
176
{
177
$fieldsList = $fieldsList + $this->additionalFields;
178
}
179
180
if
(
count
($fieldsList) > 0)
181
{
182
$result
[
'FIELDS'
] = $fieldsList;
183
}
184
185
return
$result
;
186
}
187
191
public
function
getSelectedRowsCount
()
192
{
193
if
($this->resource)
194
{
195
return
$this->resource->getSelectedRowsCount();
196
}
197
elseif
($this->resourceCDBResult)
198
{
199
if
(!($this->resourceCDBResult instanceof \
CDBResultMysql
))
200
{
201
$this->resourceCDBResult->NavStart(0);
202
}
203
204
return
$this->resourceCDBResult->SelectedRowsCount();
205
}
206
207
return
0;
208
}
209
215
public
function
getQuerySql
()
216
{
217
if
(!$this->resource)
218
{
219
return
null
;
220
}
221
222
if
(!$this->resource->getTrackerQuery())
223
{
224
return
null
;
225
}
226
227
return
$this->resource->getTrackerQuery()->getSql();
228
}
229
}
Bitrix\Main\DB\ArrayResult
Определения
arrayresult.php:10
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
Bitrix\Sender\Connector\Result\getFilterFields
getFilterFields()
Определения
result.php:106
Bitrix\Sender\Connector\Result\$fieldsDisallowed
$fieldsDisallowed
Определения
result.php:29
Bitrix\Sender\Connector\Result\getDataTypeId
getDataTypeId()
Определения
result.php:79
Bitrix\Sender\Connector\Result\setAdditionalFields
setAdditionalFields(array $additionalFields)
Определения
result.php:114
Bitrix\Sender\Connector\Result\getQuerySql
getQuerySql()
Определения
result.php:215
Bitrix\Sender\Connector\Result\getSelectedRowsCount
getSelectedRowsCount()
Определения
result.php:191
Bitrix\Sender\Connector\Result\$additionalFields
$additionalFields
Определения
result.php:26
Bitrix\Sender\Connector\Result\$dataTypeId
$dataTypeId
Определения
result.php:32
Bitrix\Sender\Connector\Result\setFilterFields
setFilterFields(array $fields)
Определения
result.php:98
Bitrix\Sender\Connector\Result\__construct
__construct($resource)
Определения
result.php:37
Bitrix\Sender\Connector\Result\fetchModifierFields
fetchModifierFields(array $result)
Определения
result.php:151
Bitrix\Sender\Connector\Result\$fields
$fields
Определения
result.php:23
Bitrix\Sender\Connector\Result\fetchPlain
fetchPlain()
Определения
result.php:122
Bitrix\Sender\Connector\Result\$resource
$resource
Определения
result.php:17
Bitrix\Sender\Connector\Result\$resourceCDBResult
$resourceCDBResult
Определения
result.php:20
Bitrix\Sender\Connector\Result\setDataTypeId
setDataTypeId($dataTypeId)
Определения
result.php:90
Bitrix\Sender\Connector\Result\fetch
fetch()
Определения
result.php:140
Bitrix\Sender\Recipient\Type\EMAIL
const EMAIL
Определения
type.php:21
CAllDBResult
Определения
dbresult.php:15
CDBResultMysql
Определения
dbresult.php:11
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Sender\Recipient
Определения
agent.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$key
if(empty($signedUserToken)) $key
Определения
quickway.php:257
count
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения
waybill.php:936
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
sender
lib
connector
result.php
Создано системой
1.14.0