Workgroup::getPresets

  1. Bitrix24 API (v. 23.675.0)
  2. socialnetwork
  3. Workgroup
  4. getPresets
  • Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/helper/workgroup.php
  • Класс: Bitrix\Socialnetwork\Helper\Workgroup
  • Вызов: Workgroup::getPresets
static function getPresets($params = []): array
{
	static $useProjects = null;
	static $extranetInstalled = null;
	static $landingInstalled = null;

	if ($extranetInstalled === null)
	{
		$extranetInstalled = self::isExtranetInstalled();
	}

	if ($landingInstalled === null)
	{
		$landingInstalled = ModuleManager::isModuleInstalled('landing');
	}

	$currentExtranetSite = (
		!empty($params)
		&& isset($params['currentExtranetSite'])
		&& $params['currentExtranetSite']
	);

	$entityOptions = (
		!empty($params)
		&& is_array($params['entityOptions'])
		&& !empty($params['entityOptions'])
			? $params['entityOptions']
			: []
	);

	$fullMode = (
		!empty($params)
		&& isset($params['fullMode'])
		&& $params['fullMode']
	);

	$result = [];
	$sort = 0;

	if ($useProjects === null)
	{
		$useProjects = (
			ModuleManager::isModuleInstalled('intranet')
			&& self::checkEntityOption([ 'project' ], $entityOptions)
		);
	}

	if (!$currentExtranetSite)
	{
		if (self::checkEntityOption([ 'open', '!extranet', '!landing' ], $entityOptions))
		{
			$result['project-open'] = [
				'SORT' => $sort += 10,
				'NAME' => ($useProjects ? Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_OPEN') : Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_OPEN')),
				'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_OPEN_DESC'),
				'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_OPEN_DESC2'),
				'VISIBLE' => 'Y',
				'OPENED' => 'Y',
				'PROJECT' => ($useProjects ? 'Y' : 'N' ),
				'EXTERNAL' => 'N',
				'TILE_CLASS' => 'social-group-tile-item-cover-open ' . ($useProjects ? 'social-group-tile-item-icon-project-open' : 'social-group-tile-item-icon-group-open')
			];
		}

		if (self::checkEntityOption([ '!open', '!extranet', '!landing' ], $entityOptions))
		{
			$result['project-closed'] = [
				'SORT' => $sort += 10,
				'NAME' => ($useProjects ? Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED') : Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_CLOSED')),
				'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED_DESC'),
				'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED_DESC'),
				'VISIBLE' => 'N',
				'OPENED' => 'N',
				'PROJECT' => ($useProjects ? 'Y' : 'N' ),
				'EXTERNAL' => 'N',
				'TILE_CLASS' => 'social-group-tile-item-cover-close ' . ($useProjects ? 'social-group-tile-item-icon-project-close' : 'social-group-tile-item-icon-group-close')
			];
		}

		if (
			$useProjects
			&& self::checkEntityOption([ 'project', 'scrum', '!extranet', '!landing' ], $entityOptions)
		)
		{
			$result['project-scrum'] = [
				'SORT' => $sort += 10,
				'NAME' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_PROJECT_SCRUM'),
				'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_PROJECT_SCRUM_DESC'),
				'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_PROJECT_SCRUM_DESC'),
				'VISIBLE' => 'N',
				'OPENED' => 'N',
				'PROJECT' => 'Y',
				'SCRUM_PROJECT' => 'Y',
				'EXTERNAL' => 'N',
				'TILE_CLASS' => 'social-group-tile-item-cover-scrum social-group-tile-item-icon-project-scrum'
			];
		}

		if (
			$fullMode
			&& self::checkEntityOption([ '!open', '!extranet', '!landing' ], $entityOptions)
		)
		{
			$result['project-closed-visible'] = [
				'SORT' => $sort += 10,
				'NAME' => ($useProjects ? Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED_VISIBLE') : Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_CLOSED_VISIBLE')),
				'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED_VISIBLE_DESC'),
				'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_CLOSED_VISIBLE_DESC'),
				'VISIBLE' => 'Y',
				'OPENED' => 'N',
				'PROJECT' => ($useProjects ? 'Y' : 'N' ),
				'EXTERNAL' => 'N',
				'TILE_CLASS' => ''
			];
		}
	}

	if (
		$extranetInstalled
		&& self::checkEntityOption([ 'extranet', '!landing' ], $entityOptions)
	)
	{
		$result['project-external'] = [
			'SORT' => $sort += 10,
			'NAME' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_EXTERNAL'),
			'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_EXTERNAL_DESC'),
			'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GP_EXTERNAL_DESC'),
			'VISIBLE' => 'N',
			'OPENED' => 'N',
			'PROJECT' => ($useProjects ? 'Y' : 'N' ),
			'EXTERNAL' => 'Y',
			'TILE_CLASS' => 'social-group-tile-item-cover-outer social-group-tile-item-icon-project-outer'
		];
	}

	if (
		$landingInstalled
		&& self::checkEntityOption([ '!project', 'landing', '!extranet' ], $entityOptions)
	)
	{
		$result['group-landing'] = [
			'SORT' => $sort += 10,
			'NAME' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_LANDING2'),
			'DESCRIPTION' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_LANDING_DESC2'),
			'DESCRIPTION2' => Loc::getMessage('SOCIALNETWORK_ITEM_WORKGROUP_TYPE_GROUP_LANDING_DESC2'),
			'VISIBLE' => 'N',
			'OPENED' => 'N',
			'PROJECT' => 'N',
			'EXTERNAL' => 'N',
			'LANDING' => 'Y',
			'TILE_CLASS' => 'social-group-tile-item-cover-public social-group-tile-item-icon-group-public'
		];
	}

	return $result;
}

Добавить комментарий