Quellcode durchsuchen

added obiekty powiązane for Storage object struct

Piotr Labudda vor 9 Jahren
Ursprung
Commit
1168eeef2e
1 geänderte Dateien mit 25 neuen und 0 gelöschten Zeilen
  1. 25 0
      SE/se-lib/Route/Storage.php

+ 25 - 0
SE/se-lib/Route/Storage.php

@@ -701,6 +701,31 @@ jQuery(document).on('p5UIBtnAjax:Storage:checkObjectInstallAjax:ajaxLoaded', fun
 				return 0;
 			});
 			$thisGetLink = array($this, 'getLink');
+			{ // not installed ref
+				$notInstalled = array_filter($item['field'], function ($field) {
+					return 'ref:' === substr($field['xsdType'], 0, 4);
+				});
+				UI::table([
+					'caption' => UI::h('span', [], "Obiekty powiązane"),
+					'rows' => array_map(function ($field) use ($thisGetLink) {
+						$ns = str_replace(['__x3A__', ':'], '/', substr($field['xsdType'], strlen('ref:')));
+						$isInstalled = (1 == DB::getPDO()->fetchValue("
+							select t.isObjectActive
+							from `CRM_#CACHE_ACL_OBJECT` t
+							where t.`namespace` = '{$ns}'
+						"));
+						return [
+							'fieldName' => $field['fieldNamespace'],
+							'xsdType' => $field['xsdType'],
+							'reinstall' => UI::h('a', [
+								'class' => "btn btn-xs btn-link",
+								'href' => $thisGetLink('objectStruct', [ 'namespace' => $ns ])
+							], "objectStruct ({$ns})"),
+							'@class' => ($isInstalled) ? "success" : "danger",
+						]; // TODO: link to install object
+					}, $notInstalled)
+				]);
+			}
 			UI::table([
 				'caption' => UI::h('span', [], [
 					UI::h('span', [ 'style' => "margin-right:6px;color:#000" ], "Struktura obiektu '{$item['namespace']}'"),