namesManagementService = $namesManagementService; } public function parseTree($treeSource, $puid, $luid) { $a = array_shift($treeSource); $result = []; if (isset($a['properties'])) { $name = ArrayHelper::getValue($a, 'name'); $result['text'] = $name ?? ''; $result['nodes'][] = $this->parseSubTree($a['properties'], $puid, $luid); } return $result; } private function parseSubTree($treeSource, $puid, $luid) { $_treeSource = $treeSource; if (!is_array($_treeSource)) { $_treeSource = [$_treeSource]; } $result = []; $PropertyAttributeValue = $this->namesManagementService->getPropertyAttributeValueColumnName(); $PropertyAttributeName = $this->namesManagementService->getPropertyAttributeNameColumnName(); foreach ($_treeSource as $item) { $anchor = ''; if (isset($item->LapStrings)) { if (is_array($item->LapStrings)) { foreach ($item->LapStrings as $item_LapStrings) { $tmp = $this->parseSubTree($item_LapStrings, $puid, $luid); if (!is_null($tmp)) { $result['nodes'][] = $tmp; } } } else { $tmp = $this->parseSubTree($item->LapStrings, $puid, $luid); if (!is_null($tmp)) { $result['nodes'][] = $tmp; } } } else { if (isset($item->LapAttributes)) { $attributes = $item->LapAttributes; if (!is_array($attributes)) { $attributes = [$attributes]; } foreach ($attributes as $attribute) { if (isset($attribute->{$PropertyAttributeName}) && $attribute->{$PropertyAttributeName} == 'Видимость') { $value = $attribute->{$PropertyAttributeValue}; if (!BooleanCaster::cast($value)) { return null; } } } } $anchor = md5(json_encode($item)); $result['href'] = Url::current([ 'puid' => $item->Plan->ReferenceUID, 'luid' => $item->LapUID, '#' => $anchor ]); } $result['text'] = "