Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
MaskExport.php
1<?php
3
4use \Bitrix\Main;
5use \Bitrix\Main\Event;
6use \Bitrix\Ui;
7use \Bitrix\UI\Avatar;
8
9class MaskExport extends ExportStep
10{
11 private const PAGE_SIZE = 1;
12 public static function getSettings(Event $event): ?array
13 {
14 $step = $event->getParameter('STEP');
15 $setting = $event->getParameter('SETTING');
16 return [
17 'SETTING' => $setting,
18 'NEXT' => false
19 ];
20 }
21
22 public function init(): void
23 {
24 $query = Avatar\Model\ItemTable::query()
25 ->setFilter([
26 '=OWNER_TYPE' => Avatar\Mask\Owner\User::class,
27 '=OWNER_ID' => $this->entityId
28 ])
29 ->setSelect(['ID', 'FILE_ID', 'TITLE', 'DESCRIPTION', 'SORT'])
30 ->setOrder(['ID' => 'ASC'])
31 ->setLimit(static::PAGE_SIZE)
32 ->setOffset($this->stepNumber * static::PAGE_SIZE)
33 ->exec();
34
35 while ($res = $query->fetch())
36 {
37 $this->data[] = $res;
38 $this->files[] = ['ID' => $res['FILE_ID']];
39 }
40 if ($this->data->count() >= static::PAGE_SIZE)
41 {
42 $this->nextStep->set('last', $this->data->current());
43 }
44 }
45}
getParameter($key)
Definition event.php:80