Group::getTasksIdsByGroupId

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Group
  4. getTasksIdsByGroupId
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/copy/integration/group.php
  • Класс: BitrixTasksCopyIntegrationGroup
  • Вызов: Group::getTasksIdsByGroupId
private function getTasksIdsByGroupId($userId, $groupId)
{
	try
	{
		$tasksIds = [];
		list($tasks, $res) = CTaskItem::fetchList($userId, [], ["GROUP_ID" => $groupId], [], ["ID", "PARENT_ID"]);
		foreach ($tasks as $task)
		{
			/** @var CTaskItem $task */
			$taskData = $task->getData(false);
			$tasksIds[$taskData["ID"]] = ($taskData["PARENT_ID"] ? $taskData["PARENT_ID"] : "");
		}

		$keyIds = [];
		foreach ($tasksIds as $key => $val)
		{
			if (array_key_exists($val, $tasksIds))
			{
				$keyIds[$key] = $key;
			}
		}

		$tasksIds = array_keys(array_diff_key($tasksIds, $keyIds));

		return $tasksIds;
	}
	catch (Exception $exception)
	{
		return [];
	}
}

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