CBPRuntime::searchActivitiesByType

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPRuntime
  4. searchActivitiesByType
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/runtime.php
  • Класс: CBPRuntime
  • Вызов: CBPRuntime::searchActivitiesByType
public function searchActivitiesByType($type, array $documentType = null)
{
	$type = mb_strtolower(trim($type));
	if ($type == '')
		return false;

	$arProcessedDirs = array();
	foreach ($this->activityFolders as $folder)
	{
		if (is_dir($folder) && $handle = opendir($folder))
		{
			while (false !== ($dir = readdir($handle)))
			{
				if ($dir == "." || $dir == "..")
					continue;
				if (!is_dir($folder."/".$dir))
					continue;
				$dirKey = mb_strtolower($dir);
				if (array_key_exists($dirKey, $arProcessedDirs))
					continue;
				if (!file_exists($folder."/".$dir."/.description.php"))
					continue;

				$arActivityDescription = array();
				$this->LoadActivityLocalization($folder."/".$dir, ".description.php");
				include($folder."/".$dir."/.description.php");

				//Support multiple types
				$activityType = (array)$arActivityDescription['TYPE'];
				foreach ($activityType as $i => $aType)
					$activityType[$i] = mb_strtolower(trim($aType));

				if (in_array($type, $activityType, true))
				{
					$arProcessedDirs[$dirKey] = $arActivityDescription;
					$arProcessedDirs[$dirKey]["PATH_TO_ACTIVITY"] = $folder."/".$dir;
					if (
						isset($arActivityDescription['FILTER']) && is_array($arActivityDescription['FILTER'])
						&& !$this->checkActivityFilter($arActivityDescription['FILTER'], $documentType)
					)
						$arProcessedDirs[$dirKey]['EXCLUDED'] = true;

				}

			}
			closedir($handle);
		}
	}

	if ($type == 'activity')
	{
		$arProcessedDirs = array_merge($arProcessedDirs, $this->getRestActivities(false, $documentType));
	}

	if ($type == 'activity' || $type == 'robot_activity')
	{
		$arProcessedDirs = array_merge($arProcessedDirs, $this->getRestRobots(false, $documentType));
	}

	if ($type !== 'condition')
	{
		BitrixMainTypeCollection::sortByColumn($arProcessedDirs, ['SORT' => SORT_ASC, 'NAME' => SORT_ASC]);
	}

	return $arProcessedDirs;
}

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