27 parent::__construct();
45 public static function getFolders(
int $siteId, ?
int $parentId =
null): array
50 if (self::$searchPhrase)
52 $filter[
'?TITLE'] =
'%' . self::$searchPhrase .
'%';
56 $filter[
'PARENT_ID'] = abs($parentId);
61 foreach ($folders as $folder)
63 $data[$folder[
'ID']] =
new Item([
64 'id' => -1 * $folder[
'ID'],
65 'entityId' =>
'landing',
66 'entityType' =>
'folder',
67 'title' => $folder[
'TITLE'],
68 'nodeOptions' => [
'dynamic' =>
true]
82 public static function getLandings(
int $siteId, ?
int $landingId =
null, ?
int $parentId =
null): array
86 $filter = [
'SITE_ID' => $siteId];
89 if (self::$searchPhrase)
92 '?TITLE' =>
'%' . self::$searchPhrase .
'%'
96 $filterSub = [
'LOGIC' =>
'OR'];
97 $filterSub[
'?TITLE'] =
'%' . self::$searchPhrase .
'%';
98 $filterSub[
'FOLDER_ID'] = [];
99 foreach ($folders as $folder)
101 $filterSub[
'FOLDER_ID'][] = $folder[
'ID'];
103 $filter[] = $filterSub;
107 $filter[
'?TITLE'] =
'%' . self::$searchPhrase .
'%';
112 $filter[
'FOLDER_ID'] = abs($parentId);
118 'ID',
'TITLE',
'FOLDER_ID',
'SITE_ID',
119 'DOMAIN_ID' =>
'SITE.DOMAIN_ID'
123 'DATE_MODIFY' =>
'desc'
126 while ($row = $res->fetch())
128 $rows[$row[
'ID']] = $row;
133 $urls = $landingFake->getPublicUrl(array_keys($rows));
136 foreach ($rows as $row)
139 if (self::$searchPhrase && $row[
'FOLDER_ID'])
143 $data[$row[
'ID']] =
new Item([
145 'selected' => $row[
'ID'] == $landingId,
146 'entityId' =>
'landing',
147 'entityType' =>
'landing',
148 'title' => $row[
'TITLE'],
149 'avatar' => $landingFake->getPreview($row[
'ID'], $row[
'DOMAIN_ID'] == 0, $urls[$row[
'ID']]),
150 'subtitle' => $subtitle ?:
''
164 $entity = $dialog->
getEntities()[
'landing'] ??
null;
167 if ($siteId = $entity->getOptions()[
'siteId'] ??
null)
184 $entity = $dialog->
getEntities()[
'landing'] ??
null;
187 if ($landingId = $entity->getOptions()[
'landingId'] ??
null)
204 $this::$searchPhrase =
null;
208 $dialog->
addItems($this::getFolders($siteId, $parentItem->
getId()));
209 $dialog->
addItems($this::getLandings($siteId, $landingId, $parentItem->
getId()));
221 $this::$searchPhrase = $searchQuery->
getQuery();
224 $dialog->
addItems($this::getLandings($siteId));
226 $this::$searchPhrase =
null;
static getFolders(int $siteId, ?int $parentId=null)
getChildren(Item $parentItem, Dialog $dialog)
__construct(array $options=[])
getLandingIdFromDialog(Dialog $dialog)
getSiteIdFromDialog(Dialog $dialog)
getSelectedItems(array $ids)
doSearch(SearchQuery $searchQuery, Dialog $dialog)
static getLandings(int $siteId, ?int $landingId=null, ?int $parentId=null)
static getBreadCrumbsString(int $folderId, string $glue, ?int $siteId=null)
static createInstance($id, array $params=array())
static getFolders(int $siteId, array $filter=[])
static getList(array $parameters=array())