if (BPConfig::$guardian_enable !== true || Guardian::authorize(Session::user(BPConfig::$guardian_identity_session_key), "META", $bpKey, null)) { if (!empty($filterSignature)) { Log::debug("* filterSignature = {$filterSignature}"); } switch ($view) { case "xml": // Render XML $xmlRendering = DraftingDesk::renderFilter("FilterXMLDrafter", $entitySignature, $filterSignature, $params); // Prepare response $xml->addChild("status", "success"); $xml->addChild("message", "Successfully rendered a filter as xml"); $xml->addChild("xml", $xmlRendering); break; case "html": // Render html $html = DraftingDesk::renderFilter($renderer, $entitySignature, $filterSignature, $params); // Encode html for packaging in xml $encodedHtml = htmlentities($html); // Prepare response $xml->addChild("status", "success"); $xml->addChild("message", "Successfully rendered a filter"); $xml->addChild("html", $encodedHtml); default: } } else { Log::warning("* Guardian denied access to META {$bpKey}"); $xml->addChild("status", "error"); $xml->addChild("message", "Access Denied"); } } catch (Exception $e) { Log::error("Caught: " . $e->getMessage());
if (empty($sessionFilters) || !is_array($sessionFilters)) { Log::warning("* Create a new set of session filters"); $sessionFilters = array(); } foreach ($filterKeys as $keyPath) { Log::debug("* Saving filter: {$keyPath}"); $sessionFilters["{$keyPath}"] = $filters["{$keyPath}"]; } // save changes to Session Session::user("_CONDUIT_FILTERS", $sessionFilters); /* // Render a new filter to include in response */ // ? Guardian: test for META access try { $xmlRendering = DraftingDesk::renderFilter("FilterXMLDrafter", $entitySignature, $filterSignature, $params); $responseNode->appendChild($dom->createElement("status", "success")); $responseNode->appendChild($dom->createELement("message", "Updated filters for {$entitySignature}")); $xmlRenderingDom = new DomDocument(); $xmlRenderingDom->loadXML($xmlRendering); $bpXmlDraftRenderingNode = $xmlRenderingDom->getElementsByTagName("bpXmlDraftRendering")->item(0); $importNode = $dom->importNode($bpXmlDraftRenderingNode, true); $xmlNode = $dom->createElement("xml"); $responseNode->appendChild($xmlNode); $xmlNode->appendChild($importNode); } catch (Exception $e) { Log::error("* Caught Exception: " . $e->getMessage()); $xml->addChild("status", "error"); $xml->addChild("message", "Caught Exception: " . $e->getMessage()); } } else {
DraftingDesk::renderList("ListDrafter", "Member.entity.xml"); echo "using ListUlDrafter<br/>"; echo "using ListUlDrafter with a ListBlueprint<br/>"; DraftingDesk::renderList("ListUlDrafter", "Member.entity.xml", "Member.Directory.list.xml"); $params = array(); $params["order"] = "lname DESC"; $params["filters"] = array(); $params["filters"]["filter_fname_like"] = "Be"; DraftingDesk::renderList("ListTableDrafter", "Member.entity.xml", null, $params); echo "<br/><br/><hr/><br/><br/>"; echo "Test FilterDrafter<br/><br/>"; $drafter = new FilterDrafter($entityBP); $html = $drafter->render(); echo $html; echo "<br/><br/>"; echo "Test Reading a Filter Blueprint<br/><br/>"; $filterBP = BlueprintReader::read("Member.Name.filter.xml"); echo "Test class instance..<br>"; if ($filterBP instanceof FilterBlueprint) { echo "filterBP is an instance of FilterBlueprint<br><br>"; } else { echo "filterBP is not an instance of FilterBlueprint<br><br>"; } echo "Test FilterDrafter with a FilterBlueprint<br/><br/>"; $drafter = new FilterDrafter($entityBP, $filterBP); $html = $drafter->render(); echo $html; echo "<br/><br/><hr/><br/><br/>"; echo "Testing DraftingDesk, renderFilter()...<br/>"; DraftingDesk::renderFilter("FilterDrafter", "Member.entity.xml", "Member.Name.filter.xml");