2namespace Bitrix\Landing;
4use Bitrix\Landing\Block\BlockRepo;
5use Bitrix\Landing\Site\Type;
6use \Bitrix\Rest\AppTable;
25 if (
$res->isSuccess())
27 Block::clearRepositoryCache();
43 if (
$res->isSuccess())
45 Block::clearRepositoryCache();
56 public static function delete($id)
58 $res = parent::delete($id);
60 if (
$res->isSuccess())
62 Block::clearRepositoryCache();
77 $langPortal = LANGUAGE_ID;
78 if (in_array($langPortal, [
'ru',
'kz',
'by',
'uz']))
85 'ID',
'NAME',
'DATE_CREATE',
'DESCRIPTION',
86 'SECTIONS',
'PREVIEW',
'APP_CODE',
'MANIFEST',
88 'DATE_CREATE_TIMESTAMP',
89 'UNIX_TIMESTAMP(DATE_CREATE)'
97 [
'=SITE_TEMPLATE_ID' => $siteTemplateId],
98 [
'=SITE_TEMPLATE_ID' =>
false]
101 [
'=SITE_TEMPLATE_ID' => $siteTemplateId]
108 while ($row =
$res->fetch())
110 $manifest = unserialize($row[
'MANIFEST'], [
'allowed_classes' =>
false]);
111 if (isset($manifest[
'lang'][$langPortal][$row[
'NAME']]))
113 $row[
'NAME'] = $manifest[
'lang'][$langPortal][$row[
'NAME']];
116 isset($manifest[
'lang_original']) &&
117 $manifest[
'lang_original'] != $langPortal &&
118 $manifest[
'lang'][
'en'][$row[
'NAME']]
121 $row[
'NAME'] = $manifest[
'lang'][
'en'][$row[
'NAME']];
126 'new' => (time() - $row[
'DATE_CREATE_TIMESTAMP']) < BlockRepo::NEW_BLOCK_LT,
127 'name' => $row[
'NAME'],
128 'description' => $row[
'DESCRIPTION'],
129 'namespace' => $row[
'APP_CODE'],
130 'type' => (
array)($manifest[
'block'][
'type'] ?? []),
131 'section' => explode(
',', $row[
'SECTIONS']),
132 'preview' => $row[
'PREVIEW'],
133 'restricted' =>
true,
134 'repo_id' => $row[
'ID'],
135 'app_code' => $row[
'APP_CODE'],
138 $blockManifest = Type::prepareBlockManifest([
'block' => $blockManifest]);
139 $items[
'repo_'. $row[
'ID']] = $blockManifest[
'block'];
152 static $manifest =
array();
154 if (!isset($manifest[$id]))
156 $manifest[$id] =
array();
157 if (($block = self::getById($id)->fetch()))
159 $manifestLocal = unserialize($block[
'MANIFEST'], [
'allowed_classes' =>
false]);
160 if (!is_array($manifestLocal))
162 $manifestLocal =
array();
165 isset($manifestLocal[
'block']) &&
166 is_array($manifestLocal[
'block'])
169 $blockDesc = $manifestLocal[
'block'];
171 $manifestLocal[
'block'] =
array(
172 'name' => $block[
'NAME'],
173 'description' => $block[
'DESCRIPTION'],
174 'namespace' => $block[
'APP_CODE'],
175 'type' => (
array)($blockDesc[
'type'] ?? []),
176 'section' => explode(
',', $block[
'SECTIONS']),
177 'preview' => $block[
'PREVIEW'],
178 'restricted' =>
true,
179 'repo_id' => $block[
'ID'],
180 'xml_id' => $block[
'XML_ID'],
181 'app_code' => $block[
'APP_CODE'],
183 if (isset($blockDesc[
'subtype']))
185 $manifestLocal[
'block'][
'subtype'] = $blockDesc[
'subtype'];
186 $manifestLocal[
'block'][
'subtype_params'] = $blockDesc[
'subtype_params'] ?? [];
189 $manifest[$id] = Type::prepareBlockManifest($manifestLocal);
190 $manifest[$id][
'timestamp'] = $block[
'DATE_MODIFY']->getTimeStamp();
194 return $manifest[$id];
204 return parent::getList(
array(
218 $codeToDelete =
array();
228 while ($row =
$res->fetch())
230 self::delete($row[
'ID']);
231 $codeToDelete[] =
'repo_' . $row[
'ID'];
234 if (!empty($codeToDelete))
236 Block::deleteByCode($codeToDelete);
247 $isArray = is_array($id);
252 $id = array_fill_keys($id,
false);
262 'ID' => array_keys($id)
265 while ($row =
$res->fetch())
267 if ($row[
'APP_CODE'])
269 $id[$row[
'ID']] = $row[
'APP_CODE'];
273 $apps = self::getAppByCode($id);
275 foreach ($id as &
$code)
291 return $isArray ? $id : array_pop($id);
294 return $apps ??
null;
313 while ($row =
$res->fetch())
315 $row[
'APP_STATUS'] = AppTable::getAppStatusInfo($row,
'');
316 $apps[$row[
'CODE']] =
array(
318 'CODE' => $row[
'CODE'],
319 'APP_NAME' => $row[
'APP_NAME'],
320 'CLIENT_ID' => $row[
'CLIENT_ID'],
321 'VERSION' => $row[
'VERSION'],
322 'DATE_FINISH' => $row[
'DATE_FINISH'],
323 'PAYMENT_ALLOW' => $row[
'APP_STATUS'][
'PAYMENT_ALLOW']
330 return is_array(
$code) ? $apps : array_pop($apps);
static isTemplateIdSystem($templateId)
static getTemplateId($siteId=null)
static getList(array $params=array())
static deleteByAppCode($code)
static update($id, $fields=array())
static getAppByCode($code)
static getAppInfo(array|int $id)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code