• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/checklist.php
  • Класс: CCheckList
  • Вызов: CCheckList::__construct
function __construct($ID = false)
{
	$this->current_result = false;
	$this->started = false;
	$this->report_id = false;
	$this->report_info = "";
	$this->checklist_path = $_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/checklist_structure.php";
	if (file_exists($this->checklist_path))
		$arCheckList = include($this->checklist_path);
	else
		return;
	//bind custom checklist
	foreach(GetModuleEvents('main', 'OnCheckListGet', true) as $arEvent)
	{
		$arCustomChecklist = ExecuteModuleEventEx($arEvent, array($arCheckList));

		if (is_array($arCustomChecklist["CATEGORIES"]))
		{
			foreach($arCustomChecklist["CATEGORIES"] as $section_id => $arSectionFields)
			{
				if (!$arCheckList["CATEGORIES"][$section_id])
				{
					$arCheckList["CATEGORIES"][$section_id] = $arSectionFields;
				}
			}
		}
		if (is_array($arCustomChecklist["POINTS"]))
		{
			foreach($arCustomChecklist["POINTS"] as $point_id => $arPointFields)
			{
				$parent = $arCustomChecklist["POINTS"][$point_id]["PARENT"];
				if (!$arCheckList["POINTS"][$point_id] && array_key_exists($parent, $arCheckList["CATEGORIES"]))
				{
					$arCheckList["POINTS"][$point_id] = $arPointFields;
				}
			}
		}
	}
	//end bind custom checklist
	$this->checklist = $arCheckList;
	$arFilter["REPORT"] = "N";
	if (intval($ID)>0)
	{
		$arFilter["ID"] = $ID;
		$arFilter["REPORT"] = "Y";
	}

	$dbResult = CCheckListResult::GetList(array(), $arFilter);
	if ($arCurrentResult = $dbResult->Fetch())
	{
		$this->current_result = unserialize($arCurrentResult["STATE"], ['allowed_classes' => false]);
		if (intval($ID)>0)
		{
			$this->report_id = intval($ID);
			unset($arCurrentResult["STATE"]);
			$this->report_info = $arCurrentResult;
		}

		foreach($arCheckList["POINTS"] as $key => $arFields)
		{
			if (empty($this->current_result[$key]))
			{
				if ($this->report_id)
					unset($this->checklist["POINTS"][$key]);
				else
					$this->current_result[$key] = array(
						"STATUS" => "W");
			}
			////$this->current_result[$key] = array("STATUS" => "A");
		}
	}
	if ($this->current_result != false && $this->report_id == false)
		$this->started = true;
}