CBPRuntime::getActivityDescription

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPRuntime
  4. getActivityDescription
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/runtime.php
  • Класс: CBPRuntime
  • Вызов: CBPRuntime::getActivityDescription
public function getActivityDescription($code, $lang = false)
{
	if (preg_match("#[^a-zA-Z0-9_]#", $code))
		return null;
	if ($code == '')
		return null;

	$code = mb_strtolower($code);
	if (mb_substr($code, 0, 3) == "cbp")
		$code = mb_substr($code, 3);
	if ($code == '')
		return null;

	$filePath = "";
	$fileDir = "";
	foreach ($this->activityFolders as $folder)
	{
		if (file_exists($folder."/".$code."/".$code.".php") && is_file($folder."/".$code."/".$code.".php"))
		{
			$filePath = $folder."/".$code."/.description.php";
			$fileDir = $folder."/".$code;
			break;
		}
	}

	if ($filePath <> '')
	{
		$arActivityDescription = array();
		if (file_exists($filePath) && is_file($filePath))
		{
			$this->LoadActivityLocalization($fileDir, ".description.php");
			include($filePath);
		}
		$arActivityDescription["PATH_TO_ACTIVITY"] = $fileDir;

		return $arActivityDescription;
	}

	if (mb_strpos($code, static::REST_ACTIVITY_PREFIX) === 0)
	{
		$code = mb_substr($code, mb_strlen(static::REST_ACTIVITY_PREFIX));
		$result = RestActivityTable::getList(array(
			'filter' => array('=INTERNAL_CODE' => $code)
		));
		$activity = $result->fetch();
		if ($activity)
		{
			return $this->makeRestActivityDescription($activity, $lang);
		}
	}

	return null;
}

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