1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
comment.php
См. документацию.
1
<?php
2
namespace
Bitrix\Forum\Copy\Implement
;
3
4
use
Bitrix\Main\Copy\Container
;
5
use
Bitrix\Main\Copy\CopyImplementer
;
6
use
Bitrix\Main\Error
;
7
use
Bitrix\Main\Result
;
8
9
class
Comment
extends
CopyImplementer
10
{
11
const
COMMENT_COPY_ERROR
=
"COMMENT_COPY_ERROR"
;
12
13
protected
$ufEntityObject
=
"FORUM_MESSAGE"
;
14
protected
$ufDiskFileField
=
"UF_FORUM_MESSAGE_DOC"
;
15
21
public
function
add
(
Container
$container,
array
$fields
)
22
{
23
$messageId
= \CForumMessage::add(
$fields
);
24
25
if
(!
$messageId
)
26
{
27
$this->result->addError(
new
Error
(
"Error creating a new comment"
, self::COMMENT_COPY_ERROR));
28
}
29
30
return
$messageId
;
31
}
32
33
public
function
update
($commentId,
array
$fields
)
34
{
35
return \CForumMessage::update($commentId,
$fields
);
36
}
37
45
public
function
getFields
(
Container
$container,
$entityId
)
46
{
47
$message
= \CForumMessage::getByIDEx(
$entityId
);
48
return
(
$message
?
$message
: []);
49
}
50
58
public
function
prepareFieldsToCopy
(
Container
$container,
array
$fields
)
59
{
60
unset(
$fields
[
"ID"
]);
61
62
if
($container->
getParentId
())
63
{
64
$fields
[
"TOPIC_ID"
] = $container->
getParentId
();
65
}
66
67
$dictionary = $container->
getDictionary
();
68
69
if
(!empty($dictionary[
"XML_ID"
]))
70
{
71
$fields
[
"XML_ID"
] = $dictionary[
"XML_ID"
];
72
}
73
74
return
$fields
;
75
}
76
85
public
function
copyChildren
(
Container
$container,
$entityId
, $copiedEntityId)
86
{
87
$this->
copyUfFields
(
$entityId
, $copiedEntityId, $this->ufEntityObject);
88
89
return
new
Result
();
90
}
91
99
public
function
updateAttachedIdsInText
(
int
$id,
array
$attachedIds, callable $auxiliaryCallback): void
100
{
101
list($field,
$text
) = $this->
getText
($id);
102
103
$detailText = call_user_func_array($auxiliaryCallback, [
104
$text
,
105
$this->ufEntityObject,
106
$id,
107
$this->ufDiskFileField,
108
$attachedIds
109
]);
110
111
$this->
update
($id, [$field => $detailText]);
112
}
113
114
protected
function
getText
($commentId)
115
{
116
$queryObject = \CForumMessage::getlist([], [
117
"ID"
=> $commentId],
false
, 0, [
"SELECT"
=> [
"POST_MESSAGE"
]]);
118
119
if
(
$fields
= $queryObject->fetch())
120
{
121
return
[
"POST_MESSAGE"
,
$fields
[
"POST_MESSAGE"
]];
122
}
123
else
124
{
125
return
[
"POST_MESSAGE"
,
""
];
126
}
127
}
128
}
$messageId
if(! $messageFields||!isset($messageFields['message_id'])||!isset($messageFields['status'])||!CModule::IncludeModule("messageservice")) $messageId
Определения
callback_ismscenter.php:26
Bitrix\Forum\Copy\Implement\Comment
Определения
comment.php:10
Bitrix\Forum\Copy\Implement\Comment\$ufEntityObject
$ufEntityObject
Определения
comment.php:13
Bitrix\Forum\Copy\Implement\Comment\getText
getText($commentId)
Определения
comment.php:114
Bitrix\Forum\Copy\Implement\Comment\$ufDiskFileField
$ufDiskFileField
Определения
comment.php:14
Bitrix\Forum\Copy\Implement\Comment\getFields
getFields(Container $container, $entityId)
Определения
comment.php:45
Bitrix\Forum\Copy\Implement\Comment\updateAttachedIdsInText
updateAttachedIdsInText(int $id, array $attachedIds, callable $auxiliaryCallback)
Определения
comment.php:99
Bitrix\Forum\Copy\Implement\Comment\COMMENT_COPY_ERROR
const COMMENT_COPY_ERROR
Определения
comment.php:11
Bitrix\Forum\Copy\Implement\Comment\add
add(Container $container, array $fields)
Определения
comment.php:21
Bitrix\Forum\Copy\Implement\Comment\update
update($commentId, array $fields)
Определения
comment.php:33
Bitrix\Forum\Copy\Implement\Comment\copyChildren
copyChildren(Container $container, $entityId, $copiedEntityId)
Определения
comment.php:85
Bitrix\Forum\Copy\Implement\Comment\prepareFieldsToCopy
prepareFieldsToCopy(Container $container, array $fields)
Определения
comment.php:58
Bitrix\Main\Copy\Container
Определения
container.php:12
Bitrix\Main\Copy\Container\getParentId
getParentId()
Определения
container.php:70
Bitrix\Main\Copy\Container\getDictionary
getDictionary()
Определения
container.php:89
Bitrix\Main\Copy\CopyImplementer
Определения
copyimplementer.php:11
Bitrix\Main\Copy\CopyImplementer\copyUfFields
copyUfFields(int $entityId, int $copiedEntityId, string $ufObject)
Определения
copyimplementer.php:67
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Main\ORM\Data\Result
Определения
result.php:16
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Forum\Copy\Implement
Определения
comment.php:2
$entityId
$entityId
Определения
payment.php:4
$message
$message
Определения
payment.php:8
$text
$text
Определения
template_pdf.php:79
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
forum
lib
copy
implement
comment.php
Создано системой
1.14.0