/** * Attempt to compare exported ACL setting with the site's existing ACL setting * * @return string */ public function aclCheckUI() { $xpath = new DOMXpath($this->doc); $parent = $xpath->query('/contenttype'); $importViewLevels = $xpath->query('/contenttype/viewlevels/viewlevel'); $importGroups = $xpath->query('/contenttype/groups/group'); $contentTypeViewLevels = array(); $contentTypeGroups = array(); $alteredGroups = array(); foreach ($importGroups as $importGroup) { $group = FabrikContentTypHelper::domNodeAttributesToArray($importGroup); $contentTypeGroups[$group['id']] = $group; } foreach ($importViewLevels as $importViewLevel) { $viewLevel = FabrikContentTypHelper::domNodeAttributesToArray($importViewLevel); $rules = json_decode($viewLevel['rules']); foreach ($rules as &$rule) { $rule = array_key_exists($rule, $contentTypeGroups) ? $contentTypeGroups[$rule]['title'] : $rule; } $viewLevel['rules_labels'] = implode(', ', $rules); $contentTypeViewLevels[] = $viewLevel; } $viewLevels = $this->getViewLevels(); $groups = $this->getGroups(); foreach ($viewLevels as &$viewLevel) { $rules = json_decode($viewLevel['rules']); foreach ($rules as &$rule) { $rule = array_key_exists($rule, $groups) ? $groups[$rule]['title'] : $rule; } $viewLevel['rules_labels'] = implode(', ', $rules); } foreach ($groups as $group) { if (array_key_exists($group['id'], $contentTypeGroups)) { $importGroup = $contentTypeGroups[$group['id']]; if ($group['lft'] !== $importGroup['lft'] || $group['rgt'] !== $importGroup['rgt'] || $group['parent_id'] !== $importGroup['parent_id']) { $alteredGroups[] = $group; } } } $layoutData = (object) array('viewLevels' => $viewLevels, 'contentTypeViewLevels' => $contentTypeViewLevels, 'match' => true, 'groups' => $groups, 'importGroups' => $contentTypeGroups, 'alteredGroups' => $alteredGroups); try { $this->validateViewLevelXML(); } catch (Exception $e) { $layoutData->match = false; } foreach ($parent as $p) { if ($p->getAttribute('ignoreacl') === 'true') { $layoutData->match = true; } } $this->checkVersion($xpath, $layoutData); $layout = FabrikHelperHTML::getLayout('fabrik-content-type-compare'); return $layout->render($layoutData); }