浏览代码

added backRef info to Storage

Piotr Labudda 8 年之前
父节点
当前提交
570ef7944a
共有 1 个文件被更改,包括 23 次插入3 次删除
  1. 23 3
      SE/se-lib/Route/Storage/AclStruct.php

+ 23 - 3
SE/se-lib/Route/Storage/AclStruct.php

@@ -665,8 +665,28 @@ class Route_Storage_AclStruct extends RouteBase {
 			$refFields = array_filter($item['field'], function ($field) {
 				return ('ref:' === substr($field['xsdType'], 0, 4) && $field['isActive']);
 			});
+			echo UI::h('h3', [], "Obiekty powiązane");
+			UI::table([
+				'rows' => array_map(function ($backRef) use ($thisGetLink) {
+					$refNamespace = $backRef['namespace'];
+					$isInstalled = (1 == DB::getPDO()->fetchValue("
+						select t.isObjectActive
+						from `CRM_#CACHE_ACL_OBJECT` t
+						where t.`namespace` = '{$refNamespace}'
+					"));
+
+					return [
+						'back ref namespace' => UI::h('a', [
+							'class' => "btn btn-xs btn-link",
+							'href' => $thisGetLink('', [ 'namespace' => $refNamespace ])
+						], "{$refNamespace}"),
+						// 'idInstance' => $backRef['idInstance'],
+						// 'isInstalled' => $isInstalled,
+						'@class' => ($isInstalled) ? "success" : "danger",
+					];
+				}, ACL::getBackRefList($item['namespace'])),
+			]);
 			UI::table([
-				'caption' => UI::h('span', [], "Obiekty powiązane (TODO backRef)"),
 				'rows' => array_map(function ($field) use ($thisGetLink) {
 					$refNamespace = str_replace(['__x3A__', ':'], '/', substr($field['xsdType'], strlen('ref:')));
 					$isInstalled = (1 == DB::getPDO()->fetchValue("
@@ -686,12 +706,12 @@ class Route_Storage_AclStruct extends RouteBase {
 						}
 					}
 					return [
-						'fieldName' => $field['fieldNamespace'],
+						'child ref name' => $field['fieldNamespace'],
 						// 'xsdType' => $field['xsdType'], // always === "ref:{$field['fieldNamespace']}"
 						'ref object' => UI::h('a', [
 							'class' => "btn btn-xs btn-link",
 							'href' => $thisGetLink('', [ 'namespace' => $refNamespace ])
-						], "objectStruct ({$refNamespace})"),
+						], "{$refNamespace}"),
 						'ref source' => UI::h('div', [],
 							(null === $refSource)
 							? [ "ref object not installed" ] // TODO: link to install? is table struct