• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/repo.php
  • Класс: BitrixLandingRepo
  • Вызов: Repo::getRepository
static function getRepository()
{
	$items = array();
	$siteId = Manager::getMainSiteId();
	$siteTemplateId = Manager::getTemplateId($siteId);
	$langPortal = LANGUAGE_ID;
	if (in_array($langPortal, ['ru', 'kz', 'by']))
	{
		$langPortal = 'ru';
	}

	$res = self::getList(array(
		'select' => array(
			'ID', 'NAME', 'DATE_CREATE', 'DESCRIPTION',
			'SECTIONS', 'PREVIEW', 'APP_CODE', 'MANIFEST',
			new BitrixMainEntityExpressionField(
				'DATE_CREATE_TIMESTAMP',
				'UNIX_TIMESTAMP(DATE_CREATE)'
			)
		),
		'filter' => array(
			'=ACTIVE' => 'Y',
			Manager::isTemplateIdSystem($siteTemplateId)
				? array(
					'LOGIC' => 'OR',
					['=SITE_TEMPLATE_ID' => $siteTemplateId],
					['=SITE_TEMPLATE_ID' => false]
				)
				: array(
					['=SITE_TEMPLATE_ID' => $siteTemplateId]
				)
		),
		'order' => array(
			'ID' => 'DESC'
		)
	));
	while ($row = $res->fetch())
	{
		$manifest = unserialize($row['MANIFEST'], ['allowed_classes' => false]);
		if (isset($manifest['lang'][$langPortal][$row['NAME']]))
		{
			$row['NAME'] = $manifest['lang'][$langPortal][$row['NAME']];
		}
		else if (
			isset($manifest['lang_original']) &&
			$manifest['lang_original'] != $langPortal &&
			$manifest['lang']['en'][$row['NAME']]
		)
		{
			$row['NAME'] = $manifest['lang']['en'][$row['NAME']];
		}

		$items['repo_'. $row['ID']] = array(
			'id' => null,
			'name' => $row['NAME'],
			'namespace' => $row['APP_CODE'],
			'new' => (time() - $row['DATE_CREATE_TIMESTAMP']) < Block::NEW_BLOCK_LT,
			'section' => explode(',', $row['SECTIONS']),
			'description' => $row['DESCRIPTION'],
			'preview' => $row['PREVIEW'],
			'restricted' => true,
			'repo_id' => $row['ID'],
			'app_code' => $row['APP_CODE']
		);
	}

	return $items;
}