8use Bitrix\Im\V2\Common\SidebarFilterProcessorTrait;
27 use SidebarFilterProcessorTrait;
31 return ReminderItem::class;
34 public static function find(
43 $reminderOrder = [
'ID' =>
'DESC'];
47 $reminderOrder[
'ID'] =
$order[
'ID'];
50 $query = LinkReminderTable::query()
51 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID',
'DATE_REMIND',
'IS_REMINDED',
'MESSAGE'])
52 ->where(
'AUTHOR_ID',
$context->getUserId())
53 ->setOrder($reminderOrder)
61 return static::initByEntityCollection(
$query->fetchCollection());
66 $reminderCollection =
new static();
68 foreach ($entityCollection as
$entity)
73 return $reminderCollection;
78 $entities = LinkReminderTable::query()
79 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID',
'DATE_REMIND',
'IS_REMINDED'])
80 ->where(
'MESSAGE_ID',
$message->getMessageId())
84 if ($entities ===
null)
89 $links = static::initByEntityCollection($entities);
91 foreach ($links as $link)
103 foreach ($links as $link)
105 $link->setEntity(
$messages[$link->getMessageId()]);
113 if (empty($messageIds))
118 $entities = LinkReminderTable::query()
119 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID',
'DATE_REMIND',
'IS_REMINDED'])
120 ->whereIn(
'MESSAGE_ID', $messageIds)
125 if ($entities ===
null)
130 return static::initByEntityCollection($entities);
135 $entities = LinkReminderTable::query()
136 ->setSelect([
'ID',
'CHAT_ID',
'AUTHOR_ID',
'DATE_CREATE',
'MESSAGE_ID',
'DATE_REMIND',
'IS_REMINDED',
'MESSAGE'])
137 ->where(
'DATE_REMIND',
'<',
new DateTime())
138 ->where(
'IS_REMINDED',
false)
142 if ($entities ===
null)
147 return static::initByEntityCollection($entities);
154 foreach ($this as $reminderItem)
156 $messageCollection->add($reminderItem->getEntity());
159 return $messageCollection;
164 $excludedList[] = ReminderPopupItem::class;
166 if (!in_array(FilePopupItem::class, $excludedList,
true))
171 return parent::getPopupData($excludedList);
176 if (!isset(
$option[
'WITHOUT_MESSAGES']) ||
$option[
'WITHOUT_MESSAGES'] !==
'Y')
181 return parent::toRestFormat(
$option);
186 static::processSidebarFilters(
190 [
'AUTHOR_ID' =>
'MESSAGE.AUTHOR_ID',
'DATE_CREATE' =>
'MESSAGE.DATE_CREATE']
193 if (isset(
$filter[
'SEARCH_MESSAGE']))
195 $query->whereLike(
'MESSAGE.MESSAGE',
"%{$filter['SEARCH_MESSAGE']}%");
198 if (isset(
$filter[
'IS_REMINDED']))
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getByMessageIdsAndAuthorId(array $messageIds, int $userId)
static find(array $filter, array $order, ?int $limit=null, ?Context $context=null)
toRestFormat(array $option=[])
static getCollectionElementClass()
static processFilters(Query $query, array $filter, array $order)
getPopupData(array $excludedList=[])
static initByEntityCollection(EO_LinkReminder_Collection $entityCollection)
static getByMessagesAndAuthorId(MessageCollection $messages, int $userId)
static getByMessage(Message $message)
static initByEntity(EO_LinkReminder $entity)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)