public function handleReRender() { $reRender = isset($_REQUEST['reRender']) ? $_REQUEST['reRender'] : false; $jsonResult = array(); if ($reRender) { $toReRender = explode(',', $reRender); $toReRender = array_map('trim', $toReRender); foreach ($toReRender as $rendering) { list($viewId, $id) = array_map('trim', explode(':', $rendering)); $doc = ZXmlParser::fromFileToTree(APP_PATH . $viewId); $element = ZXmlUtil::getElementById($doc[1], $id); $wrapper = array(0 => '', 1 => array(0 => 'z:fragment', 1 => array('xmlns:z' => 'lib://core', 'xmlns:c' => 'lib://control', 'xmlns:f' => 'lib://form', 'xmlns:l' => 'lib://layout'), 2 => array($element))); $docToRender = $this->aspect->createDocumentFromTree($viewId, $wrapper); $rendered = $docToRender->render(); $xmlTree = ZXmlParser::toTree($rendered); $jsonResult[$id] = $xmlTree[1]; } $this->envelope->reRender = $jsonResult; echo $this->envelope->toJSON(); } }
public function createDocument($file) { $doc = ZXmlParser::fromFileToTree($file); return new ZXulDocument($file, $doc, $this); }