Ejemplo n.º 1
0
 /**
  * Output the given XML and set the renderer and rendersurface
  * @param \SimpleXMLElement The XML to output
  */
 protected function renderXML($xml)
 {
     $renderer = new \System\Output\Renderer\XMLRenderer();
     $renderer->render($xml);
     $renderSurface = \System\Output\RenderSurface::getSurface('\\System\\Output\\GZIPBufferSurface');
     $renderSurface->setRenderer($renderer);
     $this->setRenderSurface($renderSurface);
 }
Ejemplo n.º 2
0
 /**
  * Combines the given blocks, and produces a Renderer to be added to a RenderSurface.
  * The Render is ready to be added to the surface.
  * @return \System\Output\Renderer The renderer to use.
  */
 public final function getRenderer()
 {
     $xml = $this->generateXML();
     switch ($this->getOutputRenderer()) {
         case self::OUTPUT_RENDERER_XML:
             $renderer = new \System\Output\Renderer\XMLRenderer();
             $renderer->render($xml);
             break;
         case self::OUTPUT_RENDERER_XSL:
             //we raise the event so the system can perform any checks on the page before actually rendering
             $event = new Event\OnBeforeRenderEvent();
             $event->setPage($this);
             $event->setXmlTree($xml);
             $event->raise($this);
             $renderer = new \System\Output\Renderer\XSLTRenderer();
             $renderer->render($xml, \System\IO\Directory::getPath($this->getXSL()), $this->getPageOptions());
             break;
         default:
             throw new \InvalidArgumentException('The given output renderer is invalid: ' . $this->getOutputRenderer());
     }
     return $renderer;
 }