44 static $renderPartsUser =
false;
45 static $renderPartsSonetGroup =
false;
46 static $renderPartsDepartment =
false;
50 !is_array($entityCodesList)
51 || empty($entityCodesList)
61 if ($renderPartsUser ===
false)
63 $renderPartsUser =
new RenderParts\User($renderOptions);
65 if ($renderPartsSonetGroup ===
false)
67 $renderPartsSonetGroup =
new RenderParts\SonetGroup($renderOptions);
69 if ($renderPartsDepartment ===
false)
71 $renderPartsDepartment =
new RenderParts\Department($renderOptions);
74 foreach ($entityCodesList as $code)
77 if (preg_match(
'/^U(\d+)$/i', $code, $matches))
79 $renderData = $renderPartsUser->getData($matches[1]);
81 elseif (preg_match(
'/^SG(\d+)$/i', $code, $matches))
83 $renderData = $renderPartsSonetGroup->getData($matches[1]);
86 preg_match(
'/^D(\d+)$/i', $code, $matches)
87 || preg_match(
'/^DR(\d+)$/i', $code, $matches)
90 $renderData = $renderPartsDepartment->getData($matches[1]);
95 && $renderData[
'name']
98 $result[$code] = $renderData[
'name'];
111 && is_array($valueList)
112 && Loader::includeModule(
'disk')
115 $attachedIdList = [];
116 foreach ($valueList as $value)
118 list($type, $realValue) = FileUserType::detectType($value);
119 if ($type == FileUserType::TYPE_NEW_OBJECT)
121 $file = \Bitrix\Disk\File::loadById($realValue, [
'STORAGE' ]);
122 $result[] = strip_tags($file->getName());
126 $attachedIdList[] = $realValue;
130 if (!empty($attachedIdList))
132 $attachedObjects = AttachedObject::getModelList([
133 'with' => [
'OBJECT' ],
135 'ID' => $attachedIdList,
138 foreach ($attachedObjects as $attachedObject)
140 $file = $attachedObject->getFile();
141 $result[] = strip_tags($file->getName());
149 public static function setIndex($params = []): void
151 if (!is_array($params))
156 $fields = ($params[
'fields'] ?? []);
157 $itemType = trim($params[
'itemType'] ??
'');
158 $itemId = (int)($params[
'itemId'] ?? 0);
171 $eventId = trim($fields[
'EVENT_ID'] ??
'');
172 $sourceId = (int)($fields[
'SOURCE_ID'] ?? 0);
173 $logId = (int)($fields[
'LOG_ID'] ?? 0);
175 $logDateUpdate =
false;
189 'select' => [
'ID',
'EVENT_ID',
'SOURCE_ID',
'LOG_UPDATE' ],
191 if ($logEntry = $res->fetch())
193 $eventId = trim($logEntry[
'EVENT_ID'] ??
'');
194 $sourceId = (int)($logEntry[
'SOURCE_ID'] ?? 0);
195 $logDateUpdate = $logEntry[
'LOG_UPDATE'];
196 $dateCreate = $logEntry[
'LOG_DATE'] ??
null;
210 'LOG_UPDATE' =>
'LOG.LOG_UPDATE',
214 if ($comment = $res->fetch())
216 $eventId = trim($comment[
'EVENT_ID'] ??
'');
217 $sourceId = (int)($comment[
'SOURCE_ID'] ?? 0);
218 $logId = (int)($comment[
'LOG_ID'] ?? 0);
219 $logDateUpdate = $comment[
'LOG_UPDATE'];
220 $dateCreate = $comment[
'LOG_DATE'];
235 'eventId' => $eventId,
236 'sourceId' => $sourceId,
242 foreach ($event->getResults() as $eventResult)
244 if ($eventResult->getType() == \
Bitrix\Main\EventResult::SUCCESS)
246 $eventParams = $eventResult->getParameters();
249 is_array($eventParams)
250 && isset($eventParams[
'content'])
253 $content = $eventParams[
'content'];
254 if (Main\Loader::includeModule(
'search'))
256 $content = \CSearch::killTags($content);
258 $content = trim(str_replace(
259 [
"\r",
"\n",
"\t" ],
291 'LOG_UPDATE' =>
'LOG.LOG_UPDATE',
295 if ($comment = $res->fetch())
297 $logId = (int)$comment[
'LOG_ID'];
298 $logDateUpdate = $comment[
'LOG_UPDATE'];
299 $dateCreate = $comment[
'LOG_DATE'];
321 'select' => [
'ID',
'LOG_UPDATE',
'LOG_DATE' ],
323 if ($logEntry = $res->fetch())
325 $logDateUpdate = $logEntry[
'LOG_UPDATE'];
328 $dateCreate = $logEntry[
'LOG_DATE'];
342 'select' => [
'ID',
'LOG_DATE' ],
344 if ($logComment = $res->fetch())
346 $dateCreate = $logComment[
'LOG_DATE'];
351 'itemType' => $itemType,
354 'content' => $content,
359 $indexFields[
'logDateUpdate'] = $logDateUpdate;
364 $indexFields[
'dateCreate'] = $dateCreate;